mysql數據庫忘記密碼

mysql數據庫忘記root密碼如何處理

1.關閉mysql數據庫:service mysql stop

2.找到etc/my.cnf 文件

在mysqld下面增加:

skip-grant-tables
skip-name-resolve

3.啓動mysql數據庫:service mysql start

4.無密碼登錄數據庫: mysql   --  回車

6.更改密碼:

use mysql;

 update user set authentication_string=PASSWORD("newpass") where user="root";

exit;

7.設置成功 ,重新改回my.cnf

希望對你有所幫助


 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章