Login MySQL Database error message error 1045 (28000) is as follows:
[[email protected] ~]# mysql-uroot-p fanshineenter password:error 1045 (28000): Access denied for user ' root ' @ ' Localhos T ' (using Password:yes)
Analysis: The existence of a database empty user caused
Solve:
Stop MySQL Service
[[Email protected] ~]# service mysqld stop
2. Enter MySQL security mode
[Email protected] ~]# mysqld_safe--user=mysql--skip-grant-tables--skip-networking &
Note:--skip-grant-tables start MySQL does not start grant-tables, authorization table;--skip-networking turn off MySQL TCP/IP connection, skip network
3. Log in to the MySQL database
[[email protected] ~]# mysql-u root MySQL
4.
mysql> use MySQL;
5. Enquiry
Mysql> select User,host,password from user;
The results are as follows:
+------+-----------+-------------------------------------------+| user | Host | Password |+------+-----------+-------------------------------------------+| | localhost | Root | localhost | *19a893fc29dbd6e2c8eaf9e248ea22aa1e1a24b7 | | Root | 127.0.0.1 | *19a893fc29dbd6e2c8eaf9e248ea22aa1e1a24b7 |+------+-----------+-------------------------------------------+
6. Delete Empty users
mysql> Delete from user where user= ';
7. Exit
Mysql> quit
8. Start the service
[[Email protected] ~]# service mysqld start
9. Re-Login
[Email protected] ~]# mysql-u root-penter Password:
Enter the password to log in.
About MySQL Login error message: Error 1045 (28000) workaround