1, disable MySQL service: # service mysql stop
2, enter the command: # mysqld_safe --user = mysql --skip-grant-tables --skip-networking &
3, into the database: #mysql -u root mysql
4、mysql> user mysql;
5, the query results in the user table (select user, host, password from user;), remove the empty table to the user query (delete from user where user = '');
6, exit the database: mysql> quit
7, start mysql service: # service mysql start;
8, re-use command 'mysql -u root -p' Log in, OK!