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):你的密碼已經過期。登錄必須改變它使用一個客戶端,支持過期的密碼。
原網站 http://blog.vpupv.com:88/index.php/archives/17/
Windows解決該問題:
1:首先:任務管理器--》關閉mysqld.exe進程;
2:先進入mysql的bin目錄下,運行如下:
> mysqld --skip-grant-tables 變為不可操作狀態、然后再新打開一個命令窗;
3:進入bin目錄下、
運行: > mysql 如下:
選擇數據庫
運行: > use mysql;
查看數據
運行: > select * from mysql.user where user=’root’ \G
將密碼過期修改為 密碼不過期;
運行: > UPDATE user SET `password_expired`='N' where user='root';
修改密碼
運行: > UPDATE user SET `authentication_string` = PASSWORD('root');
注釋:
password_expired
Y -> 密碼過期; N -> 密碼不過期;
authentication_string
這個字段是MySQL5.7版本的密碼字段、由之前的password變為authentication_string
運行: > flush privileges;
flush privileges 命令本質上的作用是將當前user和privilige表中的
用戶信息/權限設置從mysql庫(MySQL數據庫的內置庫)中提取到內存里;
運行: >quit; / exit;
運行其中一個、結束本次操作;
運行: > net start MySQL;
重啟mysql服務;便ok;
如果是在linux系統操作、
記得注釋掉/etc/my.cnf 的 skip-grant-tables;
在安裝mysql、運行mysqld install時候
遇到報錯,如下:
Install/Remove of the Service Denied;
解決方法:
打開cmd.exe程序的時候選擇“用管理員身份打開”。