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 forget the MySQL database password in Linux

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

Share

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

What Xiaobian shared with you today is how to forget the MySQL database password in Linux. I believe many people don't know much about it. In order to let you know more about the solution of forgetting the MySQL database password in Linux, I summarized the following for you. Let's look down together. I'm sure you'll get something.

The solution of forgetting Database password under Linux

1.vim / etc/my.cnf

two。 Add a line of skip-grant-tables under [mysqld], then save and exit.

3. Restart the mysql service: service mysqld restart.

4. Login to mysql-u root directly without a password

5. Modify root password through SQL

MySQL > UPDATE mysql.user SET Password=PASSWORD ('new password') where USER='root';MySQL > flush privileges;MySQL > exit

6. Modify the / etc/my.cnf file to delete the skip-grant-tables you just added.

7. Restart mysql:service mysqld restart

8. You can log in with a new password: mysql-u root-p

About how to forget the MySQL database password in Linux to share here, I hope that the above content can have a certain reference value for everyone, you can learn to apply. If you like this article, you might as well share it for more people to see.

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: 295

*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

Wechat

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

12
Report