I accidentally removed all the privileges from my MySQL root user,
Is there some way I can restore this user to its original state (with all privileges)?
i m using my sql work bench 6.0
please let me know soultion step by step as i m new in my sql.
First try
if that does not work then do the following
Stop
mysqld
service with this ( on UNix-like systems)sudo mysqld stop
Restart it with the
--skip-grant-tables
option.Connect to the mysql with just:
mysql
(i.e. no -p option, and username may not be required).Use the following in the mysql client:
UPDATE mysql.user SET Grant_priv='Y', Super_priv='Y' WHERE User='root';
Flush the privileges by running
FLUSH PRIVILEGES;
Remove
--skip-grant-tables
option. and restart mysqldFinally run
GRANT ALL ON *.* TO 'root'@'localhost';