Home > Database > Mysql Tutorial > body text

What to do if you forget mysql password in win10

coldplay.xixi
Release: 2020-10-15 11:05:45
Original
7803 people have browsed it

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.

What to do if you forget mysql password in win10

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.

What to do if you forget mysql password in win10

#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.

What to do if you forget mysql password in win10

#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"

What to do if you forget mysql password in win10

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.

What to do if you forget mysql password in win10

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
Copy after login

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.

What to do if you forget mysql password in win10

#6. Open another command line window, enter the command: mysql -u root -p, and press Enter to enter the mysql command line interface.

What to do if you forget mysql password in win10

#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';
Copy after login

In this way, the new password is set to 12345.

What to do if you forget mysql password in win10

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!