I want to create a new user in mysql with syntax:
create user \'demo\'@\'localhost\' identified by \'password\';
But it returns an error: <
In my opinion setting the "validate_password_policy" to "low" or uninstalling the "validate password plugin" is not the right thing to do. You must never compromise with security of your database (unless you don't really care). I am wondering why people are even suggesting these options when you simply can pick a good password.
To overcome this problem, I executed following command in mysql: SHOW VARIABLES LIKE 'validate_password%' as suggested by @JNevill. My "validate_password_policy" was set to Medium, along with other things. Here is the screenshot of its execution: Validate Password Policy
The result is self explanatory. For a valid password (when Password policy is set to medium):
So a valid password must obey the policy. Examples of valid password for above rules maybe:
You can pick any combination as long as it satisfies the policy.
For other "validate_password_policy" you can simply look the values for different options and pick your password accordingly (I haven't tried for "STRONG").
https://dev.mysql.com/doc/refman/5.6/en/validate-password-options-variables.html
Set password that satisfies 7 MySql validation rules
eg:- d_VX>N("xn_BrD2y
Making validation criteria bit more simple will solve the issue
SET GLOBAL validate_password_length = 6;
SET GLOBAL validate_password_number_count = 0;
But recommended a Strong password is a correct solution
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.
This error message has nothing to do with the stored password in your table. It also occures if you type (on SQL console)
"select password('123456789')"
or if
"select password('A123456789')"
or if
"select password('A!123456789')"
If you type
"select password('A!a123456789')"
then it will work. Just use big + small letters, special chars and numbers to create your password.
You can disable these checks in my.cnf, but then you will have a security risk!
in [mysqld] add:
validate_password_policy=LOW
validate_password_special_char_count=0
validate_password_length=0
validate_password_mixed_case_count=0
validate_password_number_count=0
Step 1: check your default authentication plugin
SHOW VARIABLES LIKE 'default_authentication_plugin';
Step 2: veryfing your password validation requirements
SHOW VARIABLES LIKE 'validate_password%';
Step 3: setting up your user with correct password requirements
CREATE USER '<your_user>'@'localhost' IDENTIFIED WITH '<your_default_auth_plugin>' BY 'password';
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.