天天看點

Mysql常見錯誤處理(持續更新)

  • ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement​
  • mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: YES)'

上面兩個問題,第一個是無密碼登入狀态不能執行一些指令和SQL語句.

第二個是密碼錯誤不能連接配接.需要先切換到無密碼登入狀态. 在my.ini添加skip-grant-tables.重新開機mysql服務.

下面的步驟都是修改密碼

  1. 在skip-grant-tables狀态下修改root密碼為空

MySQL 5.7.6+版本以上,在UPDATE語句中使用authentication_string列代替password列.

​use mysql​

​update user ​

​set authentication_string = '' ​

​WHERE user = 'dbadmin' AND host = 'localhost';​

​FLUSH PRIVILEGES;​

  1. 編輯my.ini檔案删除skip-grant-tables,重新開機mysql服務.

vi /etc/my.ini

​service mysqld start/stop/restart

或:systemctl mysqld restart

mysql -uroot -p

再次執行SQL指令就可以

繼續閱讀