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