排除 MySQL 技術疑難問題: Difference between revisions

Jump to navigation Jump to search
Line 329: Line 329:
* [[SQL syntax debug | SQL 語法除錯]]
* [[SQL syntax debug | SQL 語法除錯]]
* [https://www.eversql.com/sql-syntax-check-validator/ SQL 語法檢查在線上,SQL 驗證器,即時 SQL 編譯器在線上 - EverSQL] {{exclaim}} 不支持 [https://www.php.net/manual/en/pdo.prepare.php PHP: PDO::prepare],其中查詢語法包含問號。
* [https://www.eversql.com/sql-syntax-check-validator/ SQL 語法檢查在線上,SQL 驗證器,即時 SQL 編譯器在線上 - EverSQL] {{exclaim}} 不支持 [https://www.php.net/manual/en/pdo.prepare.php PHP: PDO::prepare],其中查詢語法包含問號。
== 連接和網絡錯誤 ==
=== MySQL 伺服器已斷開 (has gone away) ===
步驟
* 在 MySQL 設定檔啟用 {{kbd | key = log_error}} 選項,例如 {{kbd | key = <nowiki>log_error="file_name_of_error_log"</nowiki>}}<ref>[https://dev.mysql.com/doc/refman/8.0/en/error-log.html MySQL :: MySQL 8.0 Reference Manual :: 5.4.2 The Error Log]</ref>。
* 範例錯誤日誌位於 {{kbd | key = <nowiki>file_name_of_error_log</nowiki>}} 如下:
<pre>
2019-05-23T08:52:19.989876Z 99980 [Note] 中斷連接 99980 到資料庫:'DB_NAME' 用戶:'DB_USER' 主機:'localhost' (收到的封包大於 'max_allowed_packet' 位元組)
</pre>
* 如果 MySQL 用戶具有 {{kbd | key = <nowiki>SUPER</nowiki>}} 權限<ref>[https://dev.mysql.com/doc/refman/8.0/en/privileges-provided.html MySQL :: MySQL 8.0 Reference Manual :: 6.2.2 Privileges Provided by MySQL]</ref>,則增加 {{kbd | key = <nowiki>max_allowed_packet</nowiki>}} 的值<ref>[https://stackoverflow.com/questions/5688403/how-to-check-and-set-max-allowed-packet-mysql-variable php - how to check and set max_allowed_packet mysql variable - Stack Overflow]</ref>。


== 資源和環境錯誤 ==
== 資源和環境錯誤 ==

Navigation menu