エラー「MySQLサーバーがなくなりました」:エラーメッセージの修正方法
特にデータベースをMySQLにインポートするときに、MySQLエラー2006「MySQLサーバーがなくなりました」が何度も発生します。 エラーには簡単な解決策があります。 すべてのステップの概要については、こちらをご覧ください。
MySQLエラー2006「MySQLサーバーがなくなった」を修正するだけです
このMySQLエラーは、大きすぎるデータベース、またはアップロードするには接続が遅すぎるデータベースをインポートするときに発生します。 エラーを修正するには、MySQL構成ファイルの2つの変数を変更するだけです。
- WindowsのXAMPPの下では、C:\ xampp \ mysql \ bin \ my.cnfの構成ファイルがデフォルトで見つかります。
- このファイルが存在しない場合は、単に使用できます
右クリック>「新規」>「テキスト文書」を作成します。 - 別の実用的なヒントでは、新しいファイル拡張子(.cnf)でファイルを保存する方法を説明します。
- Linuxでは、このファイルはデフォルトで/etc/mysql/my.cnfにあります
このファイルでは、次の変数に高い値を入力します。
- wait_timeout = 60ここでは、希望するタイムアウトを秒単位で入力します-まだ低すぎる場合は、さらに長くすることができます。
- max_allowed_packet = 100Mこの変数は、アップロードの最大パッケージサイズを決定します。
次に、この変数の値を上向きに設定して、インポートするデータベースのファイルサイズよりも大きくします。 - 最後にMySQLを再起動します-エラーは発生しなくなります
- 重要:ライブシステムでは、変更された変数を後でデフォルト値にリセットする必要があります。これらは、攻撃者にとってセキュリティホールになる可能性があるためです。
次の記事では、phpMyAdminツールを使用してデータベースをMySQLにインポートする方法を示します。