当前位置:   article > 正文

记navicat导入sql文件error:MySQL server has gone away,Got a packet bigger than ‘max_allowed_packet‘ bytes_navicat mysql has gone away

navicat mysql has gone away

记navicat导入sql文件error:MySQL server has gone away,Got a packet bigger than ‘max_allowed_packet‘ bytes

今天接触了个新项目,代码clone之后,和项目负责人要sql,发现sql文件过于庞大,索性直接让我在服务器上下载,下载过后,发现sql文件高达500M之大,而且还是用的MariaDB,当我兴致勃勃导入sql文件时发现error,查看error:MySQL server has gone away,往上翻还有Got a packet bigger than ‘max_allowed_packet‘ bytes,什么,mysql 服务挂了?

问了度娘,定位了问题所在,原因是sql文件太大,在navicat 按 ctrl+shift+F6打开mysql命令行界面,输入:

mysql> show global variables like 'max_allowed_packet';
+--------------------+---------+
| Variable_name      | Value   |
+--------------------+---------+
| max_allowed_packet | 4194304 |
+--------------------+---------+
1 row in set (0.01 sec)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

发现max_allowed_packet确实太小,我们不妨调大一些:

mysql> set global max_allowed_packet=1024*1024*800;
Query OK, 0 rows affected (0.00 sec)

mysql> show global variables like 'max_allowed_packet';
+--------------------+-----------+
| Variable_name      | Value     |
+--------------------+-----------+
| max_allowed_packet | 838860800 |
+--------------------+-----------+
1 row in set (0.02 sec)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

调成了800m,接着试着导入sql文件,一路绿灯!
在这里插入图片描述

如果解决了您的问题,欢迎讨论和一键三连!!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/569886
推荐阅读
相关标签
  

闽ICP备14008679号