How to modify the mysql database password and forget the mysql Database Password
Because the database has not been used for a long time, or you forget the database password after changing the password, you cannot enter the database normally or change the password. There is a simple common password change method:
1. First, find and open the folder where mysql.exeand mysqld.exe are located (under the bin folder of your installed Mysql) and copy the path.
2.windows+ropen the logging command to enter the folder where mysql.exe is located.
3. Enter the command mysqld -- skip-grant-tables and press Enter. mysql user authentication is skipped. Note that after you enter this command, the command line cannot be operated. In this case, you can open a new command line. Note: before entering this command, run the mysqld.exe process in the task manager to ensure that the mysql server is running.
4. Then, enter mysql directly. you can log on to the database without entering any logon parameters.
5. Enter show databases. All databases are successfully logged on.
6. the mysql database is the place where the user name is saved. Enter use mysql and select mysql database.
7. view all tables in show tables and you will find a user table, which stores the user name, password, permissions, and other account information.
8. Enter select user, host, password from user; To view account information.
9. Change the root password, enter update user set password = password ('root') where user = 'root' and host = 'localhost'; change the password to root here.
10. view the account information again. select user, host, password from user; you can see that the password has been modified.
11. Exit the command line, restart the mysql database, and try to log on with the new password.