执行命令
mysql> use user Database changed mysql> source /tmp/user.sql
导入的过程中出现MySQL server has gone away错误,数据导入失败。
错误信息如下:
ERROR 2006 (HY000): MySQL server has gone awayERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 11Current database: userERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 12Current database: userERROR 2006 (HY000): MySQL server has gone awayERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 13Current database: user
开始以为是超时导致,因此调大了 connect_timeout 和 wait_timeout 的值。
重新执行后问题依旧。
解决方法:
查看资料,发现了 max_allowed_packet 参数,
官方解释是适当增大 max_allowed_packet 参数可以使client端到server端传递大数据时,系统能够分配更多的扩展内存来处理。
查看mysql max_allowed_packet的值
mysql> show global variables like 'max_allowed_packet'; +--------------------+---------+(北联网教程,专业提供视频软件下载)
……