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

How to reset the root password under mysql

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

Share

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

This article mainly explains "how to reset the root password under mysql". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to reset the root password under mysql.

Reset root password

Method 1: add the following in the [mysqld] field of my.ini:

Skip-grant-tables

Restart the mysql service, and the mysql can log in without a password

And then enter

Mysql > use mysql

Mysql > update user set password=password ('new password') WHERE User='root'

Mysql > flush privileges

After running, remove the skip-grant-tables from my.ini and restart mysqld.

Method 2 of modifying mysql password:

Do not use the method of modifying my.ini to restart the service, run mysql in non-service mode plus skip-grant-tables to change the mysql password

Stop the mysql service

Open a command line window and start using mysqld-nt.exe in the bin directory, that is, execute it in the command line window: mysqld-nt-- skip-grant-tables

Then open a separate command line window, log in to mysql, and enter the mysql password without entering the password.

After changing the password according to the above method, close the window where the command line runs mysql, and the mysql is closed. If you find that mysql is still running, you can close the corresponding process.

Start the mysql service.

At this point, I believe you have a deeper understanding of "how to reset the root password under mysql". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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