MySQL5.7初始密码密码设置

MySQL5.7 初始密码密码设置
默认密码查询:

cat /var/log/mysqld.log

grep “temporary password” /var/log/mysqld.log

这个其实与validate_password_policy的值有关。

validate_password_policy有以下取值:

Policy Tests Performed
0 or LOW Length
1 or MEDIUM Length; numeric, lowercase/uppercase, and special characters
2 or STRONG Length; numeric, lowercase/uppercase, and special characters; dictionary file

默认是1,即MEDIUM,所以刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。

有时候,只是为了自己测试,不想密码设置得那么复杂,譬如说,我只想设置root的密码为123456。

必须修改两个全局参数:

  1. 首先,修改validate_password_policy参数的值

SHOW VARIABLES LIKE ‘validate_password%’;

mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

这样,判断密码的标准就基于密码的长度了。这个由validate_password_length参数来决定。

扫描二维码关注公众号,回复: 1001019 查看本文章

mysql> select @@validate_password_length;
+—————————-+
| @@validate_password_length |
+—————————-+
| 8 |
+—————————-+
1 row in set (0.00 sec)
SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘Root123456’);

猜你喜欢

转载自blog.csdn.net/saketgd/article/details/80245863