mysql5.6.25密码_mysql 5.6.25报错ERROR 1372 (HY000): Password hash 的一点思考

本文详细记录了在MySQL 5.6.25中遇到的ERROR 1372错误,涉及在无密码认证启动数据库后,修改root用户密码时的步骤与问题。通过案例分析了password函数产生41位密码哈希的原因,指出这与old_passwords系统变量及其不同值对应的不同密码认证方法有关。建议在数据库升级或操作时充分考虑此变量的影响,确保客户端兼容性和安全性。
摘要由CSDN通过智能技术生成

问题背景:

之前使用的一套mysql 5.6.25,由于一些原因我进行了清除。大家知道我们第二次执行mysql_install_db初始化数据库时,是不会存储root的临时密码。

那么要进入mysql数据库,就引入如下的一篇文章。

案例过程:

0,以无密码认证方式启动数据库

[root@standbygtid mysql]#nohup mysqld_safe  --user=mysql --skip-grant-tables&

1,配置root用户的密码

mysql> set password for 'root'@'localhost'='system';

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

2,刷新修改用户密码的操作到mysql.user表

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

3,修改数据库用户密码,提示密码需要41个字节

mysql> set password for 'root'@'localhost'='system';

ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number

4,采用password函数修改用户密码成功

mysql> set password for 'root'@'localhost'=password('system');

Query OK, 0 rows affected (0.00 sec)

5,关闭数据库

[root@standbygtid mysql]#mysqladmin -uroot -psystem shutdown

6,启动数据库

[root@standbygtid mysql]# nohup mysqld_safe  --user=mysql&

7,可以用上述配置的数据库用户密码登陆

[root@standbygtid mysql]# mysql -uroot -psystem

Warning: Using a password on the command line interface can be insecure.

Welcome to th

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值