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

MySQL 5.7password Policy

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

Share

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

In MySQL version 5.7, user password policies are divided into low-level LOW, medium MEDIUM and super-strong STRONG, and medium MEDIUM level is recommended.

When we install MySQL, we will set the user password policy with the following command:

Shell > mysql_secure_installation

Use the following command to view the existing password policy

Mysql > SHOW VARIABLES LIKE 'validate_password%'

The validate_password_number_count parameter is at least the number of digits contained in the password, which takes effect when the password policy is MEDIUM or above.

The validate_password_special_char_count parameter is the number of special characters such as non-English digits in the password, which takes effect when the password policy is MEDIUM or above.

The validate_password_mixed_case_count parameter is the number of uppercase and lowercase characters in the password, which takes effect when the password policy is MEDIUM or above.

The validate_password_length parameter is the length of the password, which is generated by the following formula

Validate_password_number_count+ validate_password_special_char_count+ (2 * validate_password_mixed_case_count)

The validate_password_dictionary_file parameter is the dictionary file path that specifies password authentication.

The parameter validate_password_policy can be set to 0, 1, and 2, representing the password strength from low to high, respectively. The default value of this parameter is 1. If you want to weaken the password strength, change this parameter to 0.

Error creating user Times:

Mysql > CREATE USER 'test'@'localhost' IDENTIFIED BY' test'

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

Reason for reporting an error:

The specified password does not comply with the existing password policy.

Solution:

You can set the password according to the existing policy, or you can change the password policy.

① specifies the password according to the existing password policy

Mysql > CREATE USER 'test'@'localhost' IDENTIFIED BY' System#2016'

Query OK, 0 rows affected (0.16 sec)

② changes password policy to lower password verification standard

-- change password policy to LOW

Mysql > set global validate_password_policy=0

Query OK, 0 rows affected (0.00 sec)

-- change the password length

Mysql > set global validate_password_length=0

Query OK, 0 rows affected (0.00 sec)

-- the minimum password length is 4

Mysql > SHOW VARIABLES LIKE 'validate_password%';mysql > drop user' test'@localhost

Query OK, 0 rows affected (0.07 sec)

-- create a password of length 3 to report an error

Mysql > CREATE USER 'test'@'localhost' IDENTIFIED BY' tes'

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

-- create a password of length 4, which is the minimum length of the existing password policy

Mysql > CREATE USER 'test'@'localhost' IDENTIFIED BY' test'

Query OK, 0 rows affected (0.01 sec)

MySQL 5.7 change password

The password field of the user table in version 5. 7 of MYSQL has changed, no longer the password field, but the authentication_string field.

Then you can change the password with:

Update mysql.user set authentication_string=password ('password') where user='root' and Host = 'localhost'

Or

Set password for 'root'@'localhost'=password (' password')

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