- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can I restore the MySQL root user full privileges?
We can restore the MySQL root user full privileges with the help of UPDATE command.
Firstly, you need to stop mysqld and restart it with the --skip-grant-tables option. After that, connect to the mysqld server with only mysql (i.e. no -p option, and username may not be required).
Issue the below given command in the mysql client to restore the MySQL root user with full privileges.
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 super privilege.
Super_priv = 'Y'
Now we need to flush the privileges with the help of the FLUSH command.
mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.18 sec)
- Related Articles
- How can we grant privileges to a MySQL user?
- How can we revoke privileges from a MySQL user?
- How to create MySQL user with limited privileges?
- How can I change root username in MySQL?
- Check privileges (grants) for a specific user in MySQL?
- MySQL new user access denied even after giving privileges?
- Grant all privileges of a database to a MySQL user?
- How can I restore a file created by mysqldump?
- How can I restore a database dumped by mysqldump?
- What are the minimum MySQL user privileges to allow optimize and repair?
- How can I calculate full 24hour days between two specified dates in MySQL?
- How can I restore multiple databases or all databases dumped by mysqldump?
- How to check privileges in MySQL?
- How can I resize the root window in Tkinter?
- How can we change MySQL user password by using the ALTER USER statement?