解決 ubuntu mysql突然不能登入 ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using passwo…
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf #進入設定
#在 [mysqld]下面 加入下面的一行skip-grant-tables
sudo service mysql restart #重啟服務器
mysql -u root
mysql> use mysql;
mysql> update user set authentication_string=password(‘123456’) where user=’root’;
mysql> update user set plugin=”mysql_native_password” where User=’root’;
mysql> flush privileges;
mysql> quit;
sudo service mysql restart
mysql -u root -p #此時輸入密碼可以正常登入