「max_allowed_packet=100M」行を my.ini ファイルに挿入することでこの値を設定できますが、MYSQL コマンド プロンプトで「max_allowed_packet」変数を設定できませんでした。次の警告が表示されるのはなぜですか?
mysql> SHOW VARIABLES LIKE 'max_allowed_packet';
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1048576 |
+--------------------+---------+
1 row in set (0.00 sec)
mysql> warnings
Show warnings enabled.
mysql> set global max_allowed_packet=123456000;
Query OK, 0 rows affected, 1 warning (0.00 sec)
Warning (Code 1292): Truncated incorrect max_allowed_packet value: '123456000'
mysql> SHOW VARIABLES LIKE 'max_allowed_packet';
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1048576 |
+--------------------+---------+
1 row in set (0.00 sec)
mysql>
次のように小さいサイズも試しました。
mysql> set global max_allowed_packet=123456;
Query OK, 0 rows affected, 1 warning (0.00 sec)
Warning (Code 1292): Truncated incorrect max_allowed_packet value: '123456'
mysql>
mysql> set session max_allowed_packet=123456;
ERROR 1621 (HY000): SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
Warning (Code 1292): Truncated incorrect max_allowed_packet value: '123456'
Error (Code 1621): SESSION variable 'max_allowed_packet' is read-only. Use SET GLOBAL to assign the value
MySQL バージョン
mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| innodb_version | 1.1.8 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.5.25 |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | x86 |
| version_compile_os | Win64 |
+-------------------------+------------------------------+
7 rows in set (0.00 sec)
mysql>