In the company project today, such an error occurred when yiIC was used to run the database write operation, as shown in the figure below:
Project Scenario:
A big insert SQL and format for the insert INTO the TABLE VALUES (‘ A ‘, ‘B’, ‘C’), (‘ A ‘, ‘B’, ‘C’), (‘ A ‘, ‘B’, ‘C’)…
Code snippet:
It turns out that MySQL’s max_allowed_packet is too small.
The default max_allowed_packet is only 16M, which will occur if the SQL exceeds the set size.
Solutions:
1) Modify the MySQL configuration file
Edit my.cnf (My.ini under Windows) in the [mySQld] section or the server configuration section of mysql
Max_allowed_packet = 50M (or max_allowed_packet = 50*1024*1024)
2) Command line modification
set global max_allowed_packet = 50*1024*1024
Project Scenario:
A big insert SQL and format for the insert INTO the TABLE VALUES (‘ A ‘, ‘B’, ‘C’), (‘ A ‘, ‘B’, ‘C’), (‘ A ‘, ‘B’, ‘C’)…
Code snippet:
It turns out that MySQL’s max_allowed_packet is too small.
The default max_allowed_packet is only 16M, which will occur if the SQL exceeds the set size.
Solutions:
1) Modify the MySQL configuration file
Edit my.cnf (My.ini under Windows) in the [mySQld] section or the server configuration section of mysql
Max_allowed_packet = 50M (or max_allowed_packet = 50*1024*1024)
2) Command line modification
set global max_allowed_packet = 50*1024*1024
Read More:
- PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[08004] [1040] Too many connections
- PHP link database error PHP_ network_ getaddresses: getaddrinfo failed: Name or service not known
- php open(/var/lib/php/session/sess_4ofxxx, O_RDWR) failed: Permission denied (13)
- After upgrading php7, PHP program prompts an error: operator not supported for strings in causes and Solutions
- PHP Fatal error: Call to a member function query() on a non-object in
- Connection between PHP 7.4 and MySQL (MariaDB) under Ubuntu (kali Linux)
- PHP uses timthumb to generate thumbnails
- Win7 system build PHP + MySQL + Apache environment + deploy ECSHOP project
- A PHP Error was encountered Severity: Warning Message: mysqli::real_connect(): Headers and client
- PHP & nbsp; built in server array
- PHP Error
- Error report and solution of PHP module introduced by Apache
- PHP big file upload problem (500m or above)
- [vulnerability recurrence] phpMyAdmin scripts / setup.php deserialization vulnerability (wooyun-2016-199433)
- Three solutions to the appearance of notice: undefined index in PHP
- A method of collecting JS dynamic content by PHP
- Php7 compiles collect2: error: LD returned 1 exit status
- PHP:Fatal error: Class ‘COM’ not found in … How to deal with the problem
- The difference between “?” and “?:” introduced by php7
- A yellow warning appears on the pagecontroller page in PHP! ! ! !