当前位置:网站首页>MySQL:Got a packet bigger than ‘max_ allowed_ packet‘ bytes

MySQL:Got a packet bigger than ‘max_ allowed_ packet‘ bytes

2022-06-11 09:21:00 Asurplus、

We went to MySQL When importing data , When there's too much data , You're going to report a mistake :

Got a packet bigger than 'max_allowed_packet' bytes

This is because the maximum data allowed exceeds our default setting , So we need to change it MySQL Default Settings

1、 command

  • View the current configuration parameters
SHOW VARIABLES LIKE '%max_allowed_packet%';

 result
4194304/1024/1024=4M, That is to say, the maximum data allowed by our default configuration is 4M

  • Modify the current configuration
SET GLOBAL max_allowed_packet = 50 * 1024 * 1024;

In this way, we modify the maximum data allowed to be 50M

2、 The configuration file

  • Windows In the environment
    Find... In the following path my.ini file
C:\ProgramData\MySQL\MySQL Server 5.7\my.ini
  • Linux In the environment
    You can enter a command to find
whereis my.cnf

After finding the configuration file , Add parameters

max_allowed_packet=52428800

If you find deficiencies in reading , Welcome to leave a message !!!

原网站

版权声明
本文为[Asurplus、]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020507001069.html