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

How to restore full permissions of the MySQL root user?

王林
Release: 2023-09-08 15:01:08
forward
836 people have browsed it

如何恢复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
Copy after login

Above, we have set up super permissions.

Super_priv = 'Y'
Copy after login

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

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

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template