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 change the password of mysql database

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

Share

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

This article introduces the knowledge of "how to change the password of mysql database". 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!

Mysql forgot the password, how to reset the password

1. Use mysqladmin to change the mysql password

C:\ > mysqladmin-udbuser-p password newpass

Enter password: oldpass

Of course, the premise of using this command is that you add mysql to the environment variable, and if you don't add the environment variable, you can only cd to

The directory where mysqladmin is located is the same as this and that command!

-

two。 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

If you can end the corresponding process to shut down.

Start the mysql service

This is the end of "how to change the password of mysql database". 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

Database

Wechat

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

12
Report