Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL forgot how to reset the root password

2025-01-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the knowledge of "MySQL forgot how to reset root password". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Reset the password for the MySQL root user:

Create a new text file and write a SQL statement that changes the user's password.

MySQL 5.7.6 and later write this sentence:

ALTER USER 'root'@'localhost' IDENTIFIED BY' MyNewPass'

MySQL 5.7.5 and earlier wrote this sentence:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD (' MyNewPass')

The saved path can be anywhere. I saved it in the root directory of C disk for convenience. I named the file root_init.txt and the full path is C:\ root_init.txt.

Net stop mysql

Then execute the following command and apply the root_init.txt file to initialize the operation:

Mysqld-init-file= "C:\\ root_init.txt"-console

Note:

1. Write two "\" of the root_init.txt path.

2. It is best to enclose the file path in double quotation marks, especially if the path has spaces

3. If there is no mysqld command, the path to the bin directory of MySQL is generally not added to the system environment variable. You can jump to the bin path of MySQL with the cd command, and then execute the command

4. If you have a special MySQL database configuration file, you can run the following command to specify the location of the configuration file:

Mysqld--defaults-file= "C:\ ProgramData\\ mysql-8.0.15-winx64\\ my.ini"-- init-file= "C:\\ root_init.txt"-- console

5. The-- console parameter can output the information of the execution process to cmd to check whether the execution is successful or not.

Press Ctrl + C to exit the command process. Then, open the MySQL service:

Net start mysql

Log in to root users:

Mysql-u root-p "MySQL forgot how to reset your root password" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report