命令行添加mysql用户, 命令行添加新phpmyadmin登录, Access denied for user ‘test’@’localhost’ (using password: YES) except root user, Your password does not satisfy the current policy requirements

 

进入 mysql

sudo mysql

 

创建用户:

mysql> CREATE USER 'ikeepstudying'@'localhost' IDENTIFIED BY 'password';

 

如果有报错:

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

 

那么就查看 mysql 密码默认的要求:

mysql> SHOW VARIABLES LIKE 'validate_password%';

 

根据要求来创建用户密码。

如果你想修改用户密码的要求,可以用:

SET GLOBAL validate_password_length = 6;
SET GLOBAL validate_password_number_count = 0;

 

最后一步是:

mysql> FLUSH PRIVILEGES

 

完整过程是:

CREATE USER 'golden'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'golden'@'localhost';
FLUSH PRIVILEGES;

 

参考是否已经添加成功:

mysql> select Host, User from mysql.user;

 

本文:命令行添加mysql用户, 命令行添加新phpmyadmin登录, Your password does not satisfy the current policy requirements

Leave a Reply