When operating the mysql database under CentOs, a series of problems are encountered: Java code 1. ERROR 1044 (42000) during local connection: Access denied for user ''@ 'localhost' to database 'mysql' 2. remote connection 1130-host... is not allowed to connect to this MySql server 3. after the root password is changed, the system prompts ERROR 1044 (42000): Access denied for user 'root' @ 'localhost' when logging on '..... my solution is as follows: Java code 1. service mysqld stop # stop mysql service 2. yum remove mysql # uninstall mysql 3. cd/var/lib # Here is the mysql folder, which contains the database file Parts 4. mkdir mysqlbac www.2cto.com 5. mv mysql mysqlbac # back up the files that have not been uninstalled. Just in case, this step must be done. Otherwise, there are still issues after the following operations are completed. yum install mysql-server # reinstall mysql 7. service mysqld start # start mysql service 8. mysql-uroot mysql # Enter mysql database as root 9. update user set password = password ('000000') where user = 'root' # set the root password to 123456 10. flush privileges 11. after exit passes the above 11 steps, all the above problems have been solved. Author: mcj8089