WordPressエラーがでてるやんか!!【max_allowed_packet】

この記事を読む およそ時間 < 1

なんてことでしょう!!Wordpressエラーでてるよ

ということで、以下の様なエラーがエラーログをみる限り出ている。これはどのようなエラーなのだろうか!?これは、単純な話でSQL分が設定値(デフォルト)1Mbyteを越えて処理ができないよと言ってます。

サイトは普通に表示されているので、どんな影響があったのかは不明です。この前ワードプレスのVerUp以降でている可能性がありますね。DBに画像を突っ込むような場合結構このエラーは表示されるらしいです。

では、このエラーの解決方法を探ってみましょう。

Got a packet bigger than ‘max_allowed_packet’ bytes for query UPDATE `gArga12f_options` SET `option_value` =

確認方法

[sqluser@aaa httpd]#
[sqluser@aaa httpd]# mysql -p ” -r

Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 43
Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement

mysql> show variables like ‘max_allowed_packet’;

mysql> show variables like ‘max_allowed_packet’;
+——————–+——————–+
| Variable_name | Value                         |
+——————–+——————–+
| max_allowed_packet |  1048576  | 
+——————–+——————–+
1 row in set (0.00 sec)

すなわち、1,048,576byte = 1,024Kbyte = 1Mbyte ということでこいつを書き換えます。

解決方法

[sqluser@aaa httpd]# sudo vi /etc/my.cnf

[mysqld]

#MAX SQL Paket 1M -> 10M
max_allowed_packet=10M

上記を[mysqld]セッションに追記設定することで、1MBから10MBに拡張します。

アパッチを停止させて、DBを再起動させて

[sqluser@aaa httpd]# sudo /etc/rc.d/init.d/httpd stop

[sqluser@aaa httpd]# sudo /etc/rc.d/init.d/mysqld restart

再度確認する

[sqluser@aaa httpd]# mysql -p ” -r
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 84
Server version: 5.0.95 Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> show variables like ‘max_allowed_packet’;
+———————–+—————–+
| Variable_name | Value                         |
+——————–+——————–+
| max_allowed_packet | 10485760 |
+——————–+——————–+
1 row in set (0.00 sec)

10MBに変更になっている事を確認する。ここ容量は10MBが適切かどうかは後々色々な情報を元に検討してチューニングしていきたいと思います。

最後にアパッチを起動してブログなど正常に表示を確認

[sqluser@aaa httpd]# sudo /etc/rc.d/init.d/httpd start

Related posts