导入数据遇到的:ERROR : (2006, 'MySQL server has gone away') 意思就是连接断开了。
主要看下面几个参数:
1.是否重启过,如果uptime太短就是最近重启过
1 2 3 4 5 6 7
MariaDB [(none)]> show global status like 'uptime'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Uptime | 68600 | +---------------+-------+ 1 row in set (0.93 sec)
MariaDB [(none)]> show global status like 'com_kill'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Com_kill | 10 | +---------------+-------+ 1 row in set (0.00 sec) MariaDB [(none)]> show global variables like 'max_allowed_packet'; +--------------------+---------+ | Variable_name | Value | +--------------------+---------+ | max_allowed_packet | 1048576 | +--------------------+---------+ 1 row in set (0.01 sec)
那就设置大一点儿就行了,这个也可以在上面的那个文件里修改:
1 2 3 4 5 6 7 8 9 10
MariaDB [(none)]> set global max_allowed_packet=1024*1024*16; Query OK, 0 rows affected (0.03 sec)
MariaDB [(none)]> show global variables like 'max_allowed_packet'; +--------------------+----------+ | Variable_name | Value | +--------------------+----------+ | max_allowed_packet | 16777216 | +--------------------+----------+ 1 row in set (0.00 sec)