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 mysql?

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

Share

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

The main purpose of this article is to tell you briefly about how to forget the root password of mysql. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here, so let's go straight to the topic. I hope that the root password of mysql forgot how to do it. This article can bring you some practical help.

1. First, close mysql and use the `--skip-grant-tables' parameter to start mysqld.

[root@iZwz9ga6kootlfn5ejt8axZ ~] # service mysqld stop [root@iZwz9ga6kootlfn5ejt8axZ ~] # / usr/bin/safe_mysqld-skip-grant-tables&

Or

In the MySQL configuration file my.cnf, add skip-grant-tables under [mysqld], shut down the MySQL service and restart it.

Can log in without a password

2. You can log in to mysql without a password and change the password.

[root@iZwz9ga6kootlfn5ejt8axZ ~] # mysql-urootmysql > update mysql.user set password=password ("new_pass") where user= "root"; mysql > flush privileges

The password was changed successfully.

I want to close mysql at this time.

[root@iZwz9ga6kootlfn5ejt8axZ ~] # service mysqld stopStopping mysqld: [OK]

The command was executed successfully, but

[root@iZwz9ga6kootlfn5ejt8axZ ~] # netstat-tnlp | grep mysqltcp 0 0 0.0.0.0 tnlp 3306 0.0.0.0 LISTEN 13916/mysqld

Find that the mysql port still exists. Check the process.

[root@iZwz9ga6kootlfn5ejt8axZ ~] # ps-ef | grepmysql | grep-v grepmysql 13916 12911 0 11:42 pts/3 00:00:00 mysqld-- skip-grant-tables

Finally, mysqladmin shutdown is used to close successfully.

[root@iZwz9ga6kootlfn5ejt8axZ] # mysqladmin-uroot-ppassword shutdown

Mysql root password forgot what to do to tell you here, for other related issues you want to know can continue to pay attention to our industry information. Our section will capture some industry news and professional knowledge to share with you every day.

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