Home >Database >Mysql Tutorial >How to restore full permissions of the MySQL root user?
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!