Mysql max_allowed_packet query and modification Problems

Source: Internet
Author: User

When I use SQLyog to export MySQL Data today, when the data volume is large, an Error Code is displayed: 1153 Got a packet bigger than \ 'max _ allowed_packet, later, Baidu gave a solution, and I will share it with you.

Error Code: 1153 Got a packet bigger than 'max _ allowed_packet 'bytes Error message.
I didn't pay attention to it at first. I had a bunch of prompts before I saw this sentence.
When using SQLyog to export MySQL Data, when the data volume is large, the export will not be wrong, but the import will produce an error. If the SQL statement is executed separately, the Error Code: 1153 Got a packet bigger than 'max _ allowed_packet 'bytes is returned.


To solve this problem, add max_allowed_packet = 16 m at the end of my. ini (set as needed ).

Here we will introduce the specific solution

Mysql limits the size of data packets received by the server according to the configuration file.

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

View current configuration

Show VARIABLES like '% max_allowed_packet %'; the result is:

+ -------------------- + --------- + | Variable_name | Value | + -------------------- + --------- + | max_allowed_packet | 1048576 | + ---------------------- + --------- +

The preceding description shows the current configuration: 1 M.

 
Modification Method

1) method 1

You can edit my. cnf (my. ini in windows) and modify it in the [mysqld] section or mysql server configuration section.

Max_allowed_packet = 20 m. If you cannot find my. cnf, you can use

Mysql -- help | grep my. cnf to find the my. cnf file.

2) method 2


Enter mysql server

Run in mysql Command Line

Set global max_allowed_packet = 2*1024*1024*10, close the mysql server link, and then enter.

Show VARIABLES like '% max_allowed_packet %'; check whether max_allowed_packet is successfully edited.

Note: No matter what operating system you are in, we need to restart the mysql server to take effect after the settings.

Related Article

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.