Mysql logon ERROR message: ERROR 1045 (28000) solution, 104528000
This article analyzes the solution to the mysql logon ERROR: ERROR 1045 (28000. We will share this with you for your reference. The details are as follows:
I. Problems:
The root user of the mysql database in the linux system of the company has set a password, but often uses the command 'mysql-u root-p' to log on to an error, and sometimes can log on again. Logon error message:
[root@localhost ~]# mysql -u root -pEnter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Ii. Reasons:The database contains empty users.
Iii. solution:
1. Stop the mysql service:
# service mysql stop
2. Enter the following 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 users found above:
mysql> delete from user where user='';
7. Exit the database:
mysql> quit
8. Start the mysql service:
# service mysql start
9. Run the following command again:
mysql -u root -p
Log on, OK!