The solution for forgetting mysql password in win10: first close the MySQL Server service; then find the installation location of MySQL; then open the command line window and enter the command [mysql -u root -p]; finally modify the system database and change Just update the password.
Related free learning: mysql database(Video )
Solutions for forgetting mysql password in win10:
1. First, you need to shut down the MySQL Server service. In the "Run" window, enter "services.msc" to enter the "Services" window.
#2. In the service window, you can find "MySQL56", select it, and "stop" it.
In this way, the MySQL Server service will stop.
It should be noted that "MySQL56" here is limited by version. For example, if your MySQL version is 5.1, then it is "MySQL51" at this time.
Of course, you can also use "net stop MySQL56" in the command line window to stop the service.
#3. Next, you need to use the installation location of MySQL. If you forget, you can find the installation "MySQL" folder on the "Start" button (Windows key), open and select the "MySQL Server 5.6" folder, and you will see two shortcuts to open MySQL commond. Select one of them to view its properties and you can find the installation location of MySQL.
You can see that our MySQL location is in "D:\Program Files\MySQL"
4. In fact, the reason why we want to know the installation of MySQL The location is to obtain the location of the .ini file under it. This file records MySQL configuration information. If we want to skip login permissions, we have to get the location of this file.
It should be noted that different versions of the .ini file have different names. In MySQL 5.1, it is my.ini, and in MySQL 5.6, it is my-default.ini.
5. Then, open the command line window and enter the following command:
C:\Users\wang>mysqld --defaults-file="D:\Program Files\MySQL\MySQL Server 5.6\my-default.ini" --console --skip-grant-tables
It should be noted that the window cannot be written to at this time. This is also a standard to verify whether the command is executed correctly.
#6. Open another command line window, enter the command: mysql -u root -p, and press Enter to enter the mysql command line interface.
#7. Next, you only need to modify the system database and update the password.
The command you need to use is:
mysql->show database; mysql->use mysql mysql->update user set password=PASSWORD('12345') where USER='root';
In this way, the new password is set to 12345.
The above is the detailed content of What to do if you forget mysql password in win10. For more information, please follow other related articles on the PHP Chinese website!