123YYD 2020-01-03 11:49 采纳率: 0%
浏览 3307
已采纳

.net 4.0 项目 连接mysql8.0.15 使用MySql.Data.dll 连接的时候报错

string connectStr = "Server=localhost;port=3306;Database=xxx;User ID=root;Password=xxx;";
MySqlConnection conn = new MySqlConnection(connectStr);//仍还没有建立连接

try
{
conn.Open();//建立连接

//string sql = "select * from users";//sql语句

//MySqlCommand cmd = new MySqlCommand(sql, conn);//建立命令
}
catch(MySqlException ex)
{

        }


                异常信息:  Authentication to host 'localhost' for user 'root' using method 'caching_sha2_password' failed with message: Access denied for user 'root'@'localhost' (using password: YES)
                请问一下,mysql8.0.15不支持net4.0吗
                我尝试修改验证方式:
                alter user ‘root’@'localhost' identified with mysql_native_password by '密码'; 但是也没用


                详细异常信息

在 MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex)
在 MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ReadPacket()
在 MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.ContinueAuthentication(Byte[] data)
在 MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
在 MySql.Data.MySqlClient.NativeDriver.Open()
在 MySql.Data.MySqlClient.Driver.Open()
在 MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
在 MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
在 MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
在 MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
在 MySql.Data.MySqlClient.MySqlPool.GetConnection()
在 MySql.Data.MySqlClient.MySqlConnection.Open()
在 ConsoleAppMySql.Program.Connection() 位置 G:\数据库例子\ConsoleAppMySql\ConsoleAppMySql\Program.cs:行号 29

  • 写回答

2条回答 默认 最新

  • threenewbee 2020-01-03 20:07
    关注

    MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex)
    这个错误说明认证失败,还是检查下用户名密码,另外就是mysql那里用户密码和权限的设置。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题