文章目录
ERROR 1862 (HY000): Your password has expired.To log in you must change it using a client that supports expired passwords.
1. 超级用户登陆密码过期 无效
[root@server13 data]# mysql -p
Enter password:
ERROR 1862 (HY000): Your password has expired. To log in you must change it using a client that supports expired passwords.
2. 故障解决方法
[root@server13 data]# /etc/init.d/mysqld stop ##关闭mysqld进程
[root@server13 data]# rm -fr *
[root@server13 data]# ps -ef |grep mysql
[root@server13 data]# kill 2158
[root@server13 data]# ps -ef |grep mysql
root 2268 10382 0 17:49 pts/1 00:00:00 grep --color=auto mysql
[root@server13 data]# vim /etc/my.cnf
skip-networking
skip-grant-tables ##跳过权限认证
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/data/mysql.sock
symbolic-links=0
[root@server13 data]# mysqld --initialize --user=mysql
[root@server13 data]# /etc/init.d/mysqld start
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
新开一个cmd窗口,原来的别关,
输入命令:
mysql -uroot -p
出现:
Enter password:
在这里直接回车,不用输入密码。
然后就就会出现登录成功的信息。
然后在这里登SQLyog就可以登进去了
[root@server13 ~]# mysql -uroot -p
Enter password:
MySQL [(none)]> use mysql;
MySQL [mysql]> UPDATE user SET `password_expired`='N' where user='root'; ##将密码过期修改为 密码不过期;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
MySQL [mysql]> select * from mysql.user where user='root' \G; #查看数据
MySQL [mysql]> UPDATE user SET `authentication_string` = PASSWORD('root'); ##修改密码;
Query OK, 3 rows affected, 1 warning (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 1
MySQL [mysql]> flush privileges; ##将当前user和privilige表中的用户信息/权限设置从mysql库(MySQL数据库的内置库)中提取到内存里;
Query OK, 0 rows affected (0.00 sec)
MySQL [mysql]> exit;
[root@server13 data]# mysql -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.31 Source distribution
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)]> ALTER USER root@localhost identified by 'westos';
Query OK, 0 rows affected (0.00 sec) ##修改密码
密码更改后注释skip-grant-tables、skip-networking 使用修改后的密码重启mysql
[root@server13 data]# vim /etc/my.cnf
#skip-networking
#skip-grant-tables
datadir=/usr/local/mysql/data
socket=/usr/local/mysql/data/mysql.sock
symbolic-links=0
[root@server13 data]# /etc/init.d/mysqld restart