赞
踩
今天接触了个新项目,代码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)
发现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)
调成了800m,接着试着导入sql文件,一路绿灯!
如果解决了您的问题,欢迎讨论和一键三连!!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。