How to forget the MySQL database password in Linux
What Xiaobian shared with you today is how to forget the MySQL database password in Linux. I believe many people don't know much about it. In order to let you know more about the solution of forgetting the MySQL database password in Linux, I summarized the following for you. Let's look down together. I'm sure you'll get something.
The solution of forgetting Database password under Linux
1.vim / etc/my.cnf
two。 Add a line of skip-grant-tables under [mysqld], then save and exit.
3. Restart the mysql service: service mysqld restart.
4. Login to mysql-u root directly without a password
5. Modify root password through SQL
MySQL > UPDATE mysql.user SET Password=PASSWORD ('new password') where USER='root';MySQL > flush privileges;MySQL > exit
6. Modify the / etc/my.cnf file to delete the skip-grant-tables you just added.
7. Restart mysql:service mysqld restart
8. You can log in with a new password: mysql-u root-p
About how to forget the MySQL database password in Linux to share here, I hope that the above content can have a certain reference value for everyone, you can learn to apply. If you like this article, you might as well share it for more people to see.