• Slide 1 Title

    Go to Blogger edit html and replace these slide 1 description with your own words. ...

  • Slide 2 Title

    Go to Blogger edit html and replace these slide 2 description with your own words. ...

  • Slide 3 Title

    Go to Blogger edit html and replace these slide 3 description with your own words. ...

  • Slide 4 Title

    Go to Blogger edit html and replace these slide 4 description with your own words. ...

  • Slide 5 Title

    Go to Blogger edit html and replace these slide 5 description with your own words. ...

2020年7月10日星期五

UBUNTU 18.04 重設 MYSQL 5.7 的ROOT密碼

"mysql -u root -p" can't login

ubuntu phpmyadmin #1045 - access denied for user 'root'@'localhost' (using password: yes)


1. 停止MySQL服務
sudo service mysql stop

2、建立服務所需目錄並修改許可權
sudo mkdir /var/run/mysqld && sudo chown mysql: /var/run/mysqld

3、開啟安全模式
sudo mysqld_safe --skip-grant-tables --skip-networking &

4、免密碼登入MySQL並使用mysql資料庫
mysql -u root mysql

5、重設密碼
UPDATE mysql.user SET authentication_string=PASSWORD('YourNewPassword'), plugin='mysql_native_password' WHERE User='root' AND Host='localhost';

6、退出MySQL
quit

7、關閉安全模式(重要!!)
sudo mysqladmin -S /var/run/mysqld/mysqld.sock shutdown

8、重啟正常模式的MySQL服務
sudo service mysql start

9、重試一次登入MySQL
mysql -u root -p
繼續閱讀...

 
  • 聯繫本站

  • 追蹤我們