Mysql logon ERROR 1045 (28000), 104528000
1. symptom:
[Root @ localhost ~] # Mysql-u root-p
Enter password:
ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)
2. cause: the database contains empty users.
3. solution:
1) stop mysql service: # service mysql stop
2) enter the command: # mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &
3) log on to the database: # mysql-u root mysql
4) mysql> use mysql;
5) mysql> select user, host, password from user; the result is as follows:
+ ------ + ----------------------- + ---------- +
| User | host | password |
+ ------ + ----------------------- + ---------- +
| Root | % | mima |
| Root | localhost. localdomain | mima |
| Root | 127.0.0.1 | mima |
| Localhost |
| Localhost. localdomain |
+ ------ + ----------------------- + ---------- +
6) delete the empty user queried above: mysql> delete from user where user = '';
7) log out of the database: mysql> quit
8) start the mysql service: # service mysql start
9) log on again with the command 'mysql-u root-P'. OK!
Or:
1) Find the mysql configuration file, modify my. cnf, and add skip-grant-tables
2) restart the Database service mysql restart
3) use root to log on without a password, view the user table, and delete empty users.
4) release the database, modify my. cnf, and remove skip-grant-tables.
5) restart the database
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.