原因:在查詢的過程中與mysql服務器失去連接
解決:
1. 查看max_allowed_packet的值,儘量將其然後改得儘量大一些
mysql> show global variables like 'max_allowed_packet';
+--------------------+-----------+
| Variable_name | Value |
+--------------------+-----------+
| max_allowed_packet | 268435456 |
+--------------------+-----------+
1 row in set (0.00 sec)
2. 將timeout的值調大以後
mysql> show global variables like '%timeout%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 100 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| slave_net_timeout | 3600 |
| table_lock_wait_timeout | 200 |
| wait_timeout | 28800 |
+----------------------------+-------+
10 rows in set (0.00 sec)
mysql> set global net_read_timeout = 120;
Query OK, 0 rows affected (0.03 sec)
mysql> set global net_write_timeout = 900;
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like '%timeout%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| innodb_lock_wait_timeout | 100 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| net_read_timeout | 120 |
| net_write_timeout | 900 |
| slave_net_timeout | 3600 |
| table_lock_wait_timeout | 200 |
| wait_timeout | 28800 |
+----------------------------+-------+
10 rows in set (0.00 sec)