mysql.data.mysqlclient.mysqlexception:“拒绝访问用户'hobo'@'49.70.207.34'(使用密码:yes)”

bmp9r5qi  于 2021-06-16  发布在  Mysql
关注(0)|答案(1)|浏览(515)

我想使用entityframework core为identityserver4配置和操作数据。我使用了mysql。执行以下代码时出错。代码为 "serviceScope.ServiceProvider.GetRequiredService<PersistedGrantDbContext>().Database.Migrate();" 错误是

MySql.Data. MySqlClient. MySqlException: 'Access denied for user 'seen' @ '49.70.207.34' (using password: YES)' error.

但是我不知道地址49.70.207.34来自哪里,在我配置的数据库连接字符串中是另一个地址;我的连接字符串是 'server=47......;database=IdentityServer4.Configuration;user=hobo;password=123456'.

3hvapo4f

3hvapo4f1#

你可以试试这个方法

导入mysql.data.mysqlclient

Public cn As New MySqlConnection()

Public Sub openconnection()
    If cn.State <> ConnectionState.Open Then
        cn.ConnectionString = "Server=website.com; Database=YourDatabaseName; Uid=YourUsername; Pwd=YourPassword"
        cn.Open()
    End If
End Sub

Public Sub closeconnection()
    cn.Close()
End Sub

终端模块

相关问题