Accidentally mysql root privileges revoked all, find a lot of ways to restore, through practice, we found that a method is feasible, specially down.
1, the first knock service mysqld stop command, the role of command stopped mysql.
2, the security mode is activated mysql, command: / usr / bin / mysqld_safe --skip -grant-tables ( in which parameter --skip-grant-tables means skip verification database)
. 3, the root MySQL -u -p log mysql, you do not need to fill in the password.
4, select the database table mysql, command: the USE MySQL
. 5, the ON the GRANT ALL PRIVILEGES . The TO the root @ localhost the IDENTIFIED BY 'password' the WITH the GRANT the OPTION;
. 6, the flush privileges;
After the above steps can be executed.