Loss of MySql permissions problem-solving

Reference article

[Mysql] root privileges restored completely lost rookie tutorial


After today, log on to mysql with root account, show databasesthe 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):
image

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 permission

  • grant all privileges on *.* to root@'localhost' identified by "123" with grant option; # 123 is the password

  • flush privileges; # Refresh permission

  • Mysql configuration file recovery, deleted skip-grant-tables

  • Log in again, and retry flush privileges;to complete;

Guess you like

Origin www.cnblogs.com/Laggage/p/11670880.html