#昊鼎王五:如何解决“mysql5.7密码过期ERROR 1862 (HY000): Your password has expired. To log in you must change”
环境:
Centos 7.2 mysql5.7
一、mysql5.7 密码过期问题
报错:
ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.
翻译:
错误1862(HY000):你的密码已经过期。登录必须改变它使用一个客户端,支持过期的密码。
解决步骤:
1、 用忽略授权表的方法进入mysql
vi /etc/my.cnf
[mysqld]
skip-grant-tables
:wq! #保存退出
2、进入mysql,查看root用户的详细信息
# mysql -u root -p
> use mysql
> select * from mysql.user where user='root' \G
*************************** 1. row ***************************
Host: localhost
User: root
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: mysql_native_password
authentication_string: *AC241830FFDDC8943AB31CBD47D758E79F7953EA
password_expired: N
password_last_changed: 2015-11-11 16:52:49
password_lifetime: NULL
account_locked: N
1 row in set (0.00 sec)
3、把password_expired 改成不过期
> update user set password_expired='N' where user='root';
> flush privileges;
> quit
4、把 /etc/my.cnf 的 skip-grant-tables 这行注释掉
5、重启服务
service mysql restart
6、再次登陆 mysql 就正常了
[root@hd205 mysql]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.14-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MySQL [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)
MySQL [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MySQL [mysql]> exit
Bye
还有其他问题的可以在评论区留言或者如下联系方式扫码向我提问。
下一讲
《昊鼎王五:如何十分钟内在CentOS7上快速搭建集群mysql双主+keepavlied实现漂移、高可用服务之2:构建主主(互为主从)同步关系》
https://blog.youkuaiyun.com/haoding205/article/details/81481492