错误信息如下:
django.db.utils.InternalError: (1153, "Got a packet bigger than 'max_allowed_packet' bytes")

原因:max_allowed_packet值设置过小导致mysql报错,限制server接受的数据包大小。

解决方法:

[root@VM_0_4_centos ~]# whereis my.cnf  ---1.使用whereis命令 查找 my.cnf文件位置
my: /etc/my.cnf
[root@VM_0_4_centos ~]# vim /etc/my.cnf ---2.编辑my.cnf 文件
                                        --- 3.在my.ini中最后增加一行max_allowed_packet=16M即可(根据实际情况设置)
[root@VM_0_4_centos ~]# service mysqld restart  ---4.使用 service 启动:service mysqld restart 
Redirecting to /bin/systemctl restart mysqld.service
[root@VM_0_4_centos ~]# mysql -u root -p  ---验证:登陆mysql
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show VARIABLES like '%max_allowed_packet%';   ---验证:查询 max_allowed_packet       
+--------------------------+------------+
| Variable_name            | Value      |
+--------------------------+------------+
| max_allowed_packet       | 20971520   |
| slave_max_allowed_packet | 1073741824 |
+--------------------------+------------+
2 rows in set (0.00 sec)
       

实际效果

解决 MySQL(1153, "Got a packet bigger than

参考:http://www.chenxm.cc/article/845.html