Home >Database >Mysql Tutorial >How Can I Recover Full Privileges for My MySQL Root User?
Regaining Full Privileges for MySQL Root User
When handling MySQL privileges, accidental alterations can lead to restricted access, hindering essential operations. If you've inadvertently stripped some privileges from the MySQL root user, restoring its full capabilities becomes crucial.
Solution
To reinstate the root user with all its privileges, follow these steps:
sudo service mysql stop sudo service mysql start --skip-grant-tables
mysql
UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root'; FLUSH PRIVILEGES;
Restart MySQL normally:
sudo service mysql restart
Then, execute this command again to grant unrestricted access to the root user:
GRANT ALL ON *.* TO 'root'@'localhost';
After these steps, the root user will regain all its privileges, allowing you to perform necessary alterations and manage MySQL effectively.
The above is the detailed content of How Can I Recover Full Privileges for My MySQL Root User?. For more information, please follow other related articles on the PHP Chinese website!