MySQL max_allowed_packet query and modify issues

Source: Internet
Author: User

Error code:1153 Got a packet bigger than ' Max_allowed_packet ' bytes false hints.
The beginning did not notice, prompted a large pile, later saw this sentence
When you export MySQL data using the SQLyog tool, the export is not wrong when the data is large, but an error occurs when you import it. If you execute SQL separately, you will find the error code:1153 Got a packet bigger than ' Max_allowed_packet ' bytes errors.


For this problem you can add a line of max_allowed_packet=16m to the My.ini (set according to the actual situation).

Here we introduce the specific solutions

Depending on the profile, MySQL restricts the packet size that the server accepts.

Sometimes large inserts and updates are limited by max_allowed_packet parameters, resulting in failure.

View current configuration

Show VARIABLES like '%max_allowed_packet% '; The result shown is:

+--------------------+---------+ | variable_name | Value | +--------------------+---------+ | Max_allowed_packet | 1048576 | +--------------------+---------+

The above description is currently configured as: 1M


Modify method

1) Method 1

You can edit the my.cnf to modify (Windows My.ini), either in the [Mysqld] section or in the MySQL server configuration section.

Max_allowed_packet = 20M If no my.cnf can be found through

MySQL--help | grep my.cnf to find my.cnf files.

2) Method 2


Access to MySQL server

Running on the MySQL command line

Set global Max_allowed_packet = 2*1024*1024*10 then shut down this MySQL server link and re-enter.

Show VARIABLES like '%max_allowed_packet% '; see if Max_allowed_packet edited successfully

Note: No matter what operating system you are in, after setup we need to restart the MySQL server before it can take effect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.