mysql插入长文本数据报错"Lost connection to MySQL server during query (%s)" % (e,))

版权声明:欢迎评论,指点,交流! https://blog.csdn.net/qq_15230053/article/details/81978444

There are three ways to enlarge the max_allowed_packet of mysql server:

  1. Change max_allowed_packet=64M in file /etc/mysql/my.cnf on the mysql server machine and restart the server
  2. Execute the sql on the mysql server: set global max_allowed_packet=67108864;
  3. Python executes sql after connecting to the mysql:

只要执行:set global max_allowed_packet=67108864;就可以了!

猜你喜欢

转载自blog.csdn.net/qq_15230053/article/details/81978444
今日推荐