1. 程式人生 > >MySQL5.6 以上版本 首次登陸不知道預設密碼 重置密碼問題

MySQL5.6 以上版本 首次登陸不知道預設密碼 重置密碼問題

1、修改/etc/my.cnf檔案,在mysqld配置項下面增加skip-grant-tables,如下圖

2、重啟mysql服務      

#service mysqld restart

3、無密碼登陸mysql

#mysql  #update user set authentication_string=password('123abc')whereuser='root';

#flushprivileges;

4、重啟mysql服務

#service mysqld restart

5、使用新密碼訪問mysql

#mysql -u root -p 輸入新密碼,回車即完成訪問mysql;

轉載自作者yangmengling,,自己轉載記錄一下,,方便下次查詢.