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

What if I forget the root password of the MySQL5.0 database?

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge about "MySQL5.0 database root password forgotten how to do". In the actual case operation process, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

One of the easiest recovery methods:

SET PASSWORD FOR = PASSWORD(123456);

Take the above file! Save as sql.txt

Store in any folder

I'm here under E:sevser.

Run E:sevserinmysqld-nt --init-file=E: sevsersql.txt in Run

Then restart the server. Then ROOT password is automatically modified to 123456

Here's E:sevsermysql to replace the MYSQL installation directory on your own server

If you change the name of ROOT, then you have to change root for the name you changed!!

There is another way:

Windows:

1. Log in to the system with the system administrator.

2. Stop MySQL services.

3. Enter the command window, and then enter MySQL installation directory, for example, my installation directory is c:mysql, enter C:mysqlin

4. Skip permissions check Start MySQL,

c:mysqlin>mysqld-nt --skip-grant-tables

5. Open a new window, go to c:mysqlin directory, and set a new password for root

c:mysqlin>mysqladmin -u root flush-privileges password "198651"

c:mysqlin>mysqladmin -u root -p shutdown

Replace newpassword with the root password you want to use. The second command prompts you for the new password. Repeat the first command.

Password.

6. Stop MySQL Server and start MySQL in normal mode

7. You can now link to Mysql with your new password.

Command:

net mysql start Start MYSQL

net stop mysql stop MYSQL

Take Windows as an example, replace mysqld-nt in step 2 with safe_mysqld in linux.

1. Stop mysql5 service:

net stop mysql5

2. Open a DOS window and execute:

c:mysqlin>mysqld-nt --skip-grant-tables &

3. Open another DOS window and execute:

c:mysqlin>mysql mysql

> update user set password = password(123456) where user = root;

The root password is set to 123456!

4. Start MySQL5 service:

net start mysql5

"MySQL5.0 database root password forgotten how to do" the content of the introduction here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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

Database

Wechat

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

12
Report