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 to do if you forget your MySql login password in Linux environment

2025-06-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

The following mainly brings you how to forget the MySql login password in the Linux environment. I hope that how to forget the MySql login password in the Linux environment can bring you practical use, which is also the main purpose of my editing this article. All right, don't talk too much nonsense, let's just read the following.

1. Skip password authentication for MySQL

1.1 add skip-grant-tables information under [mysqld] and save exit

[root@qfx_centos sbin] # vi / etc/my.cnf

1.2 restart the MySql service

[root@qfx_centos ~] # systemctl stop mysqld.service [root @ qfx_centos ~] # systemctl start mysqld.service

two。 Modify MySQL password

2.1 Log in to MySql (if the password is empty, just enter), and refresh the permission information

# Log in to [root@qfx_centos ~] # mysql-uroot-p# to update permissions mysql > flush privileges

2.2 Update password and refresh permission information

# Update password mysql > alter user 'root'@'localhost' identified by' abc123_';# Update permissions mysql > flush privileges

3. Restore the permission verification function of MySql

3.1 quit MySql and remove the skip-grant-tables information added from / etc/my.cnf

# exit mysql > quit# Editor / etc/my.cnf, and remove skip-grant-tables information [root@qfx ~] # vi / etc/my.cnf

3.2 restart the MySql service again

[root@qfx_centos ~] # systemctl stop mysqld.service [root @ qfx_centos ~] # systemctl start mysqld.service

4. Test connection

For the above about the Linux environment to forget the MySql login password how to do, we do not find it very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

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

Servers

Wechat

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

12
Report