Centos6.7或Centos6.9下更新mysql5.7密碼 解決方案
阿新 • • 發佈:2019-01-01
本人環境為Centos6.9 + mysql5.7
1,VIM編輯mysql5.7配置檔案my.cnf
vim /www/lanmps/mysql5.7.17/my.cnf
找到[mysqld],在下面新增一行 skip-grant-tables
2. 重啟Mysql5.7
/www/lanmps/bin/mysql restart
3. root使用者登入mysql5.7,提示密碼直接回車,預設密碼為空(如上截圖)
4,修改root預設密碼,並重新整理許可權
mysql> update mysql.user
set authentication_string=password('666666') where user='root' and host='localhost';
#修改後密碼為666666
flush privileges;
#如下截圖
5,再次重啟mysql5.7
www/lanmps/bin/mysql
restart
6,測試新密碼登入,或者在phpmyadmin裡直接登入root和新密碼666666測試 如下截圖測試登入成功