【问题标题】:'Authentication to host 'localhost' for user 'root1' using method 'mysql_native_password' failed with message: Access denied for user 'root1'@'localho\'使用方法 \'mysql_native_password\' 对用户 \'root1\' 的主机 \'localhost\' 的身份验证失败,消息为:用户 \'root1\'@\'localho 的访问被拒绝
【发布时间】:2022-11-24 11:47:32
【问题描述】:

请在这里我真的需要一些帮助。我正在尝试在 Visual Studio 上连接到我的 SQL 数据库,但我不断收到以下错误;

MySql.Data.MySqlClient.MySqlException: 'Authentication to host 'localhost' for user 'root1' using method 'mysql_native_password' failed with message: Access denied for user 'root1'@'localhost' (using password: YES)' **

我的连接字符串代码如下所示


Dim sqlConn As New MySqlConnection("server=localhost; user=root1; password=adimuser; database=access_table")

Dim sqlCmd As New MySqlCommand
Dim sqlRd As MySqlDataReader
Dim sqlDT As New DataTable
Dim sqlAdapt As New MySqlDataAdapter 


Private bitmap As Bitmap


Private Sub updateTable()
    
    sqlConn.Open()
    sqlCmd.Connection = sqlConn REM This is to connect to the connection string of SQLCONN
    sqlCmd.CommandText = "SELECT * From access_control.accesstable"

    sqlRd = sqlCmd.ExecuteReader

    sqlDT.Load(sqlRd) REM Load whatever is read from the reader into the database
    sqlRd.Close()
    sqlConn.Close()

    DataGridView1.DataSource = sqlDT

End Sub

遇到同样的错误

【问题讨论】:

    标签: mysql vb.net


    【解决方案1】:

    你可以登录mysql服务器查看用户'root1',也许你会得到答案

    【讨论】:

      猜你喜欢
      • 2017-10-14
      • 2017-01-19
      • 2016-10-27
      • 2021-08-23
      • 2018-06-24
      • 2020-01-21
      • 1970-01-01
      • 2013-07-28
      • 2023-03-20
      相关资源
      最近更新 更多