装完mysql启动服务,第一次使用需要重置密码,显示我输入的密码"123456"太简单,在个人练习过程中,不想把密码设置太复杂
# grep password /var/log/mysql.log
2022-01-02T05:03:18.625427Z 1 [Note] A temporary password is generated for root@localhost: )Vl+vhJE%9yj
# mysqladmin -uroot -p")Vl+vhJE%9yj" password "123456"
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
mysqladmin: unable to change password; error: 'Your password does not satisfy the current policy requirements'
解决方案:
# mysql -uroot -p')Vl+vhJE%9yj'
(1)修改validate_password_policy参数值为0(1为开启复杂策略)
注意:此参数(policy)必须优先修改,因为policy策略不修改为0会影响下面的length参数。
mysql> set global validate_password_policy=0;
(2)修改validate_password_length参数值为1
mysql> set global validate_password_length=1;
退出重新修改密码
mysql > exit;
# mysqladmin -uroot -p')Vl+vhJE%9yj' password
输入密码: 123456
确认密码: 123456