MySQL5.7出現Your password has expired. To log in you must change it using a client that supports expir


今天晚上本來想寫bootstrap-fileinput插件集成fastdfs的文章,但是剛啟動idea里面的QiYuAdmin就出現了錯誤: 
Your password has expired. To log in you must change it using a client that supports expired passwords.其實只需要修改密碼就可以了,這個問題我找到了以下解決辦法:

1、修改 /etc/my.cnf,在 [mysqld] 小節下添加一行:skip-grant-tables=1

這一行配置讓 mysqld 啟動時不對密碼進行驗證

2、重啟 mysqld 服務:systemctl restart mysqld

3、使用 root 用戶登錄到 mysql:mysql -u root

4、切換到mysql數據庫,更新 user 表:

update mysql.user set authentication_string=password(‘root’) where user=’root’ and Host = ‘localhost’;

flush privileges;

在之前的版本中,密碼字段的字段名是 password,5.7版本改為了 authentication_string

5、退出 mysql,編輯 /etc/my.cnf 文件,刪除 skip-grant-tables=1 的內容

6、重啟 mysqld 服務,再用新密碼登錄。但此時還是不行哦,我以為可以了,就沒有往下看了。其實還有最后一步。

7、alter user ‘root’@’localhost’ identified by ‘root’;

有個疑問,不知道為什么程序是一直鏈接不上的,但是客戶端,比如Navcat和MySQL的WorkBench都是可以鏈接上的?最后一段我是直接在Navcat里面執行的


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM