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

Centos7 change mysql password and modify Policy

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

Share

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

After centos7, MySQL (5.7) installed through yum source, log in MySQL for the first time, you need to check the log file first, find the temporary password, and then modify the password after logging in. Or, modify the password policy, of course, you also choose not to modify the password policy, I am doing testing, so simple password is more convenient. The specific operation is as follows:

Change password:

Start MySQL

2. View temporary password

grep 'temporary password' /var/log/mysqld.log

2017-05-06T05:58:54.621766Z 1 [Note] A temporary password is generated for root@localhost: +AqLt/ftS1)k

3. Log in to MySQL with a temporary password

mysql -u root -p +AqLt/ftS1

4. Change password

ALTER USER 'root'@'localhost' IDENTIFIED BY '123';

5. Test landing

Modify password policy: (Temporary password must be modified first before password policy can be viewed, before simple password can be modified!!!)

1. View current password policy

show variables like '%password%';

| Variable_name | Value |

+---------------------------------------+--------+

| default_password_lifetime | 0 |

| disconnect_on_expired_password | ON |

| log_builtin_as_identified_by_password | OFF |

| mysql_native_password_proxy_users | OFF |

| old_passwords | 0 |

| report_password | |

| sha256_password_proxy_users | OFF |

| validate_password_check_user_name | OFF |

| validate_password_dictionary_file | |

| validate_password_length | 8 |

| validate_password_mixed_case_count | 1 |

| validate_password_number_count | 1 |

| validate_password_policy | MEDIUM |

| validate_password_special_char_count | 1 |

+---------------------------------------+--------+

2. Modify the policy (add the following statement to the configuration file)

vi /etc/my.conf

validate_password = off

Description: off or OFF; 0 or LOW; 1 or MEDIUM; 2 or STRONG

MySQL official website password policy details: dev.mysql.com/doc/refman/5.7/en/validate-password-options-variables.html#sysvar_validate_password_policy

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