ECS Windows server MySQL reset root password

藏色散人
Release: 2019-02-15 11:47:03
forward
2184 people have browsed it

ECS Windows server MySQL can refer to the following method to reset the root password. Please refer to the actual situation. Please make a backup before operation.

1. Stop the MySQL service:

First check whether the MySQL service is started. If it is started, stop the MySQL service first. There are two ways to stop it:

1) Explanation [Start] Menu--[Run]--Execute the "cmd" command to open the command prompt window and execute

net stop MySQL5.1
Copy after login

ECS Windows server MySQL reset root password

Note: "MySQL5.1" here refers to The full name of the MySQL service must be subject to the actual situation. The query command is as follows:

sc query state=all | findstr /i mysql
Copy after login

After the command is executed, the full name of the MySQL service will be displayed.

ECS Windows server MySQL reset root password

You can also view the full name of the MySQL service in [Management Tools]--[Services].

ECS Windows server MySQL reset root password

2) In [Management Tools]-[Services], find the MySQL service, double-click the MySQL service name, and click [Stop].

ECS Windows server MySQL reset root password

2. Skip permission security check:

Execute command:

C:\websoft\mysql\bin\mysqld --defaults-file="C:\websoft\mysql\my.ini" --console --skip-grant-tables
Copy after login

After this command is executed, the MySQL service will run. When you connect to MySQL later, you don't need to enter the password temporarily.

ECS Windows server MySQL reset root password

Note: C:\websoft\mysql\bin\mysqld --is the directory path of the MySQL service process

--defaults-file="C :\websoft\mysql\my.ini" -- is the directory path of the MySQL configuration file. Please refer to the on-site environment.

3. Log in to MySQL:

Open a new command prompt window and log in to MySQL. The command is as follows:

C:\websoft\mysql\bin\mysql -uroot -p
Copy after login

In the Enter password: interface, press Enter directly (no need password), a successful login message appears.

ECS Windows server MySQL reset root password

4. Reset password:

Execute the following commands in sequence:

use mysql; UPDATE user SET Password=PASSWORD('newpassword') where USER='root'; FLUSH PRIVILEGES; quit
Copy after login

Note: "newpassword" is the new one Password, please define your own password.

5. Verify password:

The MySQL password has been reset through the above steps. You can log in again for verification. The command is as follows:

C:\websoft\mysql\bin\mysql -uroot -p Enter password: *********** 在此界面输入新的密码即可登录。
Copy after login

Note: After the password change is completed, if The user's website program uses the above modified account to connect to the database. Please promptly adjust the password used to connect to the database in the program to prevent the user's program business from being unable to connect to the database.

Recommended tutorial: "mysql tutorial"//m.sbmmt.com/course/list/51.html

The above is the detailed content of ECS Windows server MySQL reset root password. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:aliyun.com
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
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!