MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.AuthenticationFailed(Exception ex)
这个错误说明认证失败,还是检查下用户名密码,另外就是mysql那里用户密码和权限的设置。
.net 4.0 项目 连接mysql8.0.15 使用MySql.Data.dll 连接的时候报错
40string 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
- 点赞
- 写回答
- 关注问题
- 收藏
- 复制链接分享
- 邀请回答