修改MySQL密碼:
1.cmd 進(jìn)入命令界面
2.進(jìn)入mysql.exe所在目錄。即bin 目錄
3.計(jì)算機(jī)-》管理》服務(wù)進(jìn)程里》關(guān)閉mysql服務(wù)
4.輸入命令? mysqld --skip-grant-tables? 回車
5.輸入mysql
6.輸入show databases
7.輸入 use mysql;? 選擇mysql數(shù)據(jù)庫(kù)。
8.輸入show tables
? 查看所有表,會(huì)發(fā)現(xiàn)有個(gè)user表,這里存放的就是用戶名,密碼,權(quán)限等等賬戶信息
9.輸入select user,host,password from user;? 來(lái)查看賬戶信息。
注意此處:若出現(xiàn)錯(cuò)誤:ERROR 1054 (42S22): Unknown column 'password' in 'field list'則用authentication_string替換password。
10.輸入update user set authentication_string=password('123456') where user='root' and host='localhost';
11.再次查看賬戶信息,select user,host,password from user;
12.退出命令行,重啟mysql數(shù)據(jù)庫(kù),用新密碼嘗試登錄。
mysql -uroot -p123456
13.測(cè)試不帶密碼登錄mysql,發(fā)現(xiàn)還是能夠登陸上,但顯示數(shù)據(jù)庫(kù)時(shí)只能看到兩個(gè)數(shù)據(jù)庫(kù)了,說(shuō)明重啟之后跳過(guò)密碼驗(yàn)證已經(jīng)被取消了。
14.select user,host,authentication_string from user;
(注意在詞句之前請(qǐng)輸入:use mysql;)