How can I restore the MySQL root user’s full privileges?

Stop MySQL server.
Start MySQL server with --skip-grant-tables:

mysqld_safe --skip-grant-tables &
Login (your password not need):
mysql -uroot

Fix privileges:

UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
FLUSH PRIVILEGES;
Create root user, if need;
GRANT ALL ON *.* TO 'root'@'localhost';
GRANT ALL ON *.* TO 'root'@'%';

Update privileges:

FLUSH PRIVILEGES;

That's all!

Добавить комментарий