MySQL导入数据提示Lost connection to MySQL server

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL导入数据提示Lost connection to MySQL server相关的知识,希望对你有一定的参考价值。

数据库版本为Mariadb 5.5,使用K8S进行管理
mysql -uroot -p xxxx < xxxxx.sql
在本地提示
ERROR 2013 (HY000) at line 1320: Lost connection to MySQL server during query

这个是因为mysql的max_allow_packet默认的只有16MB,我们在mysql的配置文件中添加一行
max_allowed_packet=100M

或者修改pod下的args参数
args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--event_scheduler=ON", "--max_allowed_packet=100M", "--skip-name-resolve"]

添加一个"--max_allowed_packet=100M" 即可

以上是关于MySQL导入数据提示Lost connection to MySQL server的主要内容,如果未能解决你的问题,请参考以下文章

2013 lost connection to mysql server during query

MySQL# [Err] 1118-Row size too large (> 8126)Lost connection to MySQL server at ‘reading initial’

MySQL# [Err] 1118-Row size too large (> 8126)Lost connection to MySQL server at ‘reading initial’

虚拟主机连接数据库Lost.. to MySQL ... at 'reading initial communication packet', system error: 111

MySQL 批量写入数据报错:mysql_query:Lost connection to MySQL server during query

Mysql 插入大数据量数据报错:Lost connection to MySQL server during query