報錯原因是:密碼過期。不管你是剛剛修改密碼還是什么,只要登陸都是有問題的,都是報這樣子的錯誤。
解決方法是:
1、修改/etc/my.cnf文件,在[mysqld]下加入“skip-grant-tables”。
2、重啟mysql服務器
3、登陸mysql
[root@:vg_adn_tidbCkhsTest /usr/local/src]#mysql -u root -p #此處直接按下enter鍵即可 Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.24 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)]> update mysql.user set password_expired='N' where user='root' -> ; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 MySQL [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) MySQL [(none)]> exit
4、修改/etc/my.cnf。把“skip”這一行內容注釋掉
5、再次重啟mysql服務器即可