mysql数据库导入sql文件时提示“Error Code: 1153 - Got a packet bigger than 'max_allowed_packet' bytes”解决办法
向mysql数据库中导入sql文件时,如果文件过大(几百M),会提示“Error Code: 1153 - Got a packet bigger than 'max_allowed_packet' bytes”
1.查看目前数据库配置
show VARIABLES like '%max_allowed_packet%';
显示如下结果
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1048576 |
+--------------------+---------+
说明目前的配置是:1048576/1024/1024 = 1M
2.修改my.ini文件中“max_allowed_packet”的值
路径在mysql的安装目录中
3.修改后,重启mysql服务
在cmd窗口下,先执行net stop mysql;再执行net start mysql
然后再到sqlyog中执行show VARIABLES like '%max_allowed_packet%';发现值已更改