Molet

mysql数据库导入sql文件时提示“Error Code: 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes”解决办法

Molet Java 2023-02-26 806浏览 0

向mysql数据库中导入sql文件时,如果文件过大(几百M),会提示“Error Code: 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes”

mysql数据库导入sql文件时提示“Error Code: 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes”解决办法

mysql数据库导入sql文件时提示“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的安装目录中
mysql数据库导入sql文件时提示“Error Code: 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes”解决办法

mysql数据库导入sql文件时提示“Error Code: 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes”解决办法

3.修改后,重启mysql服务

在cmd窗口下,先执行net stop mysql;再执行net start mysql

然后再到sqlyog中执行show VARIABLES like ‘%max_allowed_packet%’;发现值已更改

mysql数据库导入sql文件时提示“Error Code: 1153 – Got a packet bigger than ‘max_allowed_packet’ bytes”解决办法

 

继续浏览有关 数据库技术文章/教程 的文章
发表评论