The following articles mainly introduce the actual Solution to the Problem of forgetting the MySQL database password. If you encounter similar situations in actual operations, the following articles will be very useful to you and hope to help you in this aspect.
MySQL5.0 was installed a long time ago, and the passwords of the two MySQL databases were forgotten. I searched the internet and found the solution as follows:
I. Window
1. net stop MySQL Service
2. Run MySQLd-nt -- skip-grant-tables.
In this way, you can access MySQL without the MySQL database password.
3. Open a new command window, execute MySQL, and enter MySQL
4. Modify the root password
- use MySQL
- update user set passwordpassword=password('NEW PASSWORD') where user='root';
- flush privileges;
5. kill the MySQLd-nt process in the task manager.
6. net start MySQL restart MySQL.
Ii. linux
1. killall-TERM MySQLd stops the MySQL Service
2. bin/safe_MySQLd -- skip-grant-tables &
In this way, you can access MySQL without the MySQL database password.
3. Run MySQL to enter MySQL
4. use MySQL
- update user set passwordpassword=password('NEW PASSWORD') where user='root';
- flush privileges;
5. killall-TERM MySQLd
6. bin/safe_MySQLd restart MySQL
The above content is an introduction to the solutions for forgetting the MySQL password. I hope you will find some gains.