How to deal with the database disappeared after modifying the root password of mysql under Linux?

  

If you do not modify the mysql root password through the password() function in Linux system, the mysql database will disappear. Some people may not know and directly modify the mysql root password, so the mysql database disappeared, how to deal with this time?

can be solved by the following ways:

1, modified mysql database catalog profile: my.cnf (or my.ini)

[mysqld] at Add:

skip-grant-tables

2. Restart the mysql service and log in with mysql.

3, after entering, you can see that the mysql database has been rendered, and then change the password:

update user set password=password(’root‘) where user=’root‘;

flush privileges;

4. Exit mysql and modify the configuration file my.cnf to comment out the skip-grant-tables.

5, restart the mysql service, and then you can log in with your username and password.

The above is the way to modify the mysql root password after the database disappears under Linux, the next time you want to mysql root password, remember to use the password () function, so as not to cause unnecessary losses.

Copyright © Windows knowledge All Rights Reserved