[乐意黎]MySQL 导入时抛 You can change this value on the server by setting the max_allowed_packet' variable.

r囧r小猫 2022-05-24 02:47 178阅读 0赞

如题

错误信息:Packet for query is too large (5241794 > 4194304). You can change this value on the server by setting the max_allowed_packet’ variable.

测试

[root@aerchi.com etc]# mysql -uroot -p

Enter password:

mysql> show VARIABLES like ‘%max_allowed_packet%’;

+—————————————+——————+
| Variable_name | Value |
+—————————————+——————+
| max_allowed_packet | 4194304 |
| slave_max_allowed_packet | 1073741824 |
+—————————————+——————+

2 rows in set (0.00 sec)

解决

在 /etc/my.cnf 里添加
vim /etc/my.cnf

[mysqld]
max_allowed_packet = 1000M

:wq 保存

service mysqld restart 重启后

再次查看:

mysql> show variables like ‘%max_a%’;
+—————————————+——————+
| Variable_name | Value |
+—————————————+——————+
| max_allowed_packet | 1048576000 |
| slave_max_allowed_packet | 1073741824 |
+—————————————+——————+
2 rows in set (0.00 sec)

OK, 成功解决

乐意黎

2018-05-18

发表评论

表情:
评论列表 (有 0 条评论,178人围观)

还没有评论,来说两句吧...

相关阅读