Mysql Access denied for user 'root' @ 'localhost' (using password: YES), deniedlocalhost
[Symptom description]
C/S program remote access is normal, local access reports the following exception
MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication to host 'localhost' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'@'localhost' (using password: YES) ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Access denied for user 'root'@'localhost' (using password: YES)
The configuration file is as follows:
<add name="RemoteConnString" connectionString="Database='mealbooker';Data Source='localhost';User Id='root';Password='123456';charset='gb2312';pooling=true" providerName="MySql.Data.MySqlClient"/>
[Analysis]
For permission issues, check the user table in the mysql database.
It is found that the nominal value of localhost is null, so the localhost in connection string is changed to 127.0.0.1. The test passes ~~~
[Solution]
The configuration file is changed to localhost, and the database access is normal. At the same time, the mysql command line tool enters the password, and the problem is solved in a flash.
In addition, the mysql command line tool flashed through. For more information, see here.