Home  >  Article  >  Database  >  How to restore full permissions of the MySQL root user?

How to restore full permissions of the MySQL root user?

王林
王林forward
2023-09-08 15:01:08814browse

如何恢复MySQL root用户的完全权限?

We can use the UPDATE command to restore the full permissions of the MySQL root user.

First, you need to stop mysqld and restart it using the --skip-grant-tables option. Afterwards, just use mysql to connect to the mysqld server (i.e. no -p option, and probably no username required).

Issue the command given below in mysql client to restore the MySQL root user with full permissions.

mysql> UPDATE mysql.user SET Grant_priv = 'Y', Super_priv = 'Y' WHERE User = 'root';
Query OK, 0 rows affected (0.04 sec)
Rows matched: 1  Changed: 0  Warnings: 0

Above, we have set up super permissions.

Super_priv = 'Y'

Now we need to refresh the permissions with the FLUSH command.

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.18 sec)

The above is the detailed content of How to restore full permissions of the MySQL root user?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete