mysql学习(-):mysql 5.7更改密码与更改权限
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mysql' WITH GRANT OPTION GRANT OPTION ;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql 错误如上,首先用 mysql -uroot -p 登陆 并检查用户规则:
mysql> show variables like 'validate_password%' -> ; +--------------------------------------+--------+ | Variable_name | Value | +--------------------------------------+--------+ | validate_password_check_user_name | OFF | | validate_password_dictionary_file | | | validate_password_length | 6 | | validate_password_mixed_case_count | 1 | | validate_password_number_count | 1 | | validate_password_policy | MEDIUM | | validate_password_special_char_count | 1 | +--------------------------------------+--------+ 7 rows in set (0.00 sec)
更改上variable的值
SET GLOBAL validate_password_length = 5; SET GLOBAL validate_password_number_count = 0; SET GLOBAL validate_password_mixed_case_count = 0; SET GLOBAL validate_password_special_char_count = 0;
最后创建一个database和用户并设置简单的密码
CREATE DATABASE test; GRANT ALL PRIVILEGES ON test.* TO user@localhost IDENTIFIED BY "pass1"
用 mysql -u user -p test 登陆测试成功 password为“pass1”