Reference article
[Mysql] root privileges restored completely lost rookie tutorial
After today, log on to mysql with root account, show databases
the command returns only two tables, and then use the use database command prompt I do not have permission;
problem shown in (I use the root account login):
Internet to find some missing permissions problem solving blog to solve the problem
Proceed as follows:
Shut down mysql service,
systemctl stop mysqld
Modify the configuration file mysql the my.cnf (can
mysql --help|grep 'my.cnf'
see the my.cnf ** ** path command) is added in the last line of the following code:skip-grant-tables
Save, start MySQL (
systemctl start mysqld
)Log mysql ->
mysql -u root -p
prompted for a password do not enter anything directly enter , so skip the permissions check log in directly to the mysql;use mysql
(At this time we need to give root privileges to update)update user set Update_priv=‘Y’ where user=‘root';
(Then the permissions set permissions )update user set Grant_priv =’Y’ where user = ‘root';
Giving it the highest authority #
flush privileges;
# refresh permissiongrant all privileges on *.* to root@'localhost' identified by "123" with grant option;
# 123 is the passwordflush privileges;
# Refresh permissionMysql configuration file recovery, deleted
skip-grant-tables
Log in again, and retry
flush privileges;
to complete;