I want to create new user in mysql with syntax:
create user 'demo'@'localhost' identified by 'password';
But it's error. "your password does not satisfy the current policy requirements".
I try many password but it's not work. So how can I fix this?
Because of your password. You can see password validate configuration metrics using SHOW VARIABLES LIKE 'validate_password%';
in mysql
or you can set the password policy level lower, for example :
SET GLOBAL validate_password_length = 6;
SET GLOBAL validate_password_number_count = 0;
You can watch this video: ERROR 1819 (HY000): Your password does not satisfy the current policy requirements - Mysql (Youtube)
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_policy=LOW;
After running the command sudo mysql_secure_installation
.
- Run
sudo mysql
to enter into the mysql prompt.
- Run this
SELECT user,authentication_string,plugin,host FROM mysql.user;
to check for user root to have as plugin auth_socket.
- Then do run
uninstall plugin validate_password;
to drop priviledges before running
this ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Be sure to change password to a strong password.
NOTE: check out this link https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04 for more help
For MySQL 8*
SET GLOBAL validate_password.policy=LOW
Reference Link to explain about policy - Click Here
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';