【搬運】MySQL常見問題及解決(ing)

官方錯誤代碼字典html

如下是平時遇到就增長一條(大部分來自搜索,再也不一一列舉來源,感謝各位大神的經驗分享,解救吾等小白於水火 Orz)mysql

鏈接相關

  • ERROR 1129 (HY000)

_ Host * is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts' _sql

緣由:數據庫

同一個ip在短期內產生太多中斷的數據庫鏈接而致使的阻塞(即超過mysql數據庫max_connection_errors的最大值)code

解決:server

法一:刷新htm

mysqladmin flush-hosts -h host -u user -pip

法二:修改錯誤最大鏈接數get

配置文件/etc/my.cnf(不一樣系統可能不一樣),max_connection_errors=23 # 自定義域名

  • ERROR 1045 Access Denied

_ Got error: 1045: Access denied for user 'root'@'127.0.0.1' (using password: YES) when trying to connect _

密碼錯誤,或者沒給該IP給訪問權限,你懂的。

  • ERROR 1862 密碼過時

在使用mysqldump -uroot -h127.0.0.1時出現了1046錯誤下面的錯誤:

_ mysqldump: Got error: 1862: Your password has expired. To log in you must change it using a client that supports expired passwords. when trying to connect _

若是肯定密碼沒有問題且沒有設置過時,這種狀況通常都是數據庫設置了禁止域名解析(配置文件中skip_name_resolve)致使的,禁止域名解析後,沒法將127.0.0.1轉爲localhost,按下面步驟解決。

mysql -h127.0.0.1 -uroot -p
set password for 'root'@'127.0.0.1'=password('your pwd here');
flush privileges;

語法問題解決

  1. 字段名使用了SQL語法預留的關鍵字

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key' at line 1

其實不少都是字段名使用了SQL保留關鍵的緣由,如這裏的'key',MySQL關鍵字檢索:MySQL 5.7 關鍵詞

相關文章
相關標籤/搜索