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

The default password of mysql under centos forgot how to solve it.

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

Share

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

The default password of mysql under centos forgot how to solve it? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!

Centos mysql default password forgotten solution: 1, use "grep 'temporary password' / var/log/mysqld.log" to find the installation of the initial password; 2, use the centos system account and password to force login, and then modify the password.

First, retrieve the initial password at the time of installation:

1. Grep 'temporary password' / var/log/mysqld.log

Method 2. Use the operating system account and password to force login and change the password.

1. Mysql-uroot-p

2. Enter your centos password

3. Change the password

UPDATE mysql.user SET authentication_string = PASSWORD ('MyNewPassword') WHERE User =' root' AND Host = 'localhost'

Note: if ERROR 1819 (HY000): Your password does not satisfy the current policy requirements is displayed, your password does not meet the security requirements

4 、 FLUSH PRIVILEGES

5 、 quit

Method 3. Force the modification of the password

1 、 systemctl stop mysqld

2. Systemctl set-environment MYSQLD_OPTS= "- skip-grant-tables"

3 、 systemctl start mysqld

4. Mysql-u root

5. UPDATE mysql.user SET authentication_string = PASSWORD ('MyNewPassword') WHERE User =' root' AND Host = 'localhost'

Note: if ERROR 1819 (HY000): Your password does not satisfy the current policy requirements is displayed, your password does not meet the security requirements

6 、 FLUSH PRIVILEGES

7 、 quit

Thank you for reading! After reading the above, do you have a general idea of how to solve the default password of mysql under centos? I hope the content of the article will be helpful to all of you. If you want to know more about the relevant articles, you are welcome to follow the industry information channel.

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