Your password does not satisfy the current policy requirements
I want to create a new user in MySQL with the syntax:
create user 'demo'@'localhost' identified by 'password';
But it returns an error:
Your password does not satisfy the current policy requirements.
I have tried many passwords but they don't work. How can I fix this?
Because of your password. You can see password validate configuration metrics using the following query in MySQL client:
SHOW VARIABLES LIKE 'validate_password%';
The output should be something like that :
+--------------------------------------+-------+
| Variable_name | Value |
+--------------------------------------+-------+
| validate_password.check_user_name | ON |
| validate_password.dictionary_file | |
| validate_password.length | 6 |
| validate_password.mixed_case_count | 1 |
| validate_password.number_count | 1 |
| validate_password.policy | LOW |
| validate_password.special_char_count | 1 |
+--------------------------------------+-------+
then you can set the password policy level lower, for example:
SET GLOBAL validate_password.length = 6;
SET GLOBAL validate_password.number_count = 0;
Check the MySQL Documentation.
NOTE: This might not be a secure solution. But if you are working on a test environment, just need a quick fix and doesn't even care about the security settings. This is a quick solution.
The same issue happened to me when I ran "mysql_secure_installation" and modified password security level to 'medium'.
I bypassed the error by running the followings:
mysql -h localhost -u root -p
mysql>uninstall plugin validate_password;
make sure you reinstall the plugin "validate_password" if necessary.
If you don't care what the password policy is. You can set it to LOW by issuing below mysql command:
mysql> SET GLOBAL validate_password.length = 4;
mysql> SET GLOBAL validate_password.policy=LOW;
For MySQL 8*
SET GLOBAL validate_password.policy=LOW
Reference Link to explain about policy - Click Here
For MySQL 8 you can use the following script:
SET GLOBAL validate_password.LENGTH = 4;
SET GLOBAL validate_password.policy = 0;
SET GLOBAL validate_password.mixed_case_count = 0;
SET GLOBAL validate_password.number_count = 0;
SET GLOBAL validate_password.special_char_count = 0;
SET GLOBAL validate_password.check_user_name = 0;
ALTER USER 'user'@'localhost' IDENTIFIED BY 'pass';
FLUSH PRIVILEGES;