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

.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 用三极管设计一个单管共射放大电路
  • ¥20 fluent无法启动
  • ¥15 孟德尔随机化r语言运行问题
  • ¥15 pyinstaller编译的时候出现No module named 'imp'
  • ¥15 nirs_kit中打码怎么看(打码文件是csv格式)
  • ¥15 怎么把多于硬盘空间放到根目录下
  • ¥15 Matlab问题解答有两个问题
  • ¥15 LCD12864中文显示
  • ¥15 在使用CH341SER.EXE时不小心把所有驱动文件删除了怎么解决
  • ¥15 gsoap生成onvif框架