Home > Database > Mysql Tutorial > How to Fix MySQL Error 1153: Maximum Packet Size Exceeded?

How to Fix MySQL Error 1153: Maximum Packet Size Exceeded?

Mary-Kate Olsen
Release: 2024-12-06 22:55:18
Original
348 people have browsed it

How to Fix MySQL Error 1153: Maximum Packet Size Exceeded?

MySQL Error 1153: Maximum Packet Size Exceeded

When you encounter MySQL error 1153 while importing a dump, it indicates that the packet size of the imported data exceeds the maximum allowed packet size for your MySQL instance.

Determining the Correct Settings

To resolve this issue, you need to increase the maximum allowed packet size. This setting exists both for the MySQL client and server.

Client-Side Setting

Modify the client command to specify the increased packet size:

mysql --max_allowed_packet=100M -u root -p database < dump.sql
Copy after login

Server-Side Setting

Edit the MySQL configuration file (my.cnf or my.ini) and locate the [mysqld] section. Adjust the following setting:

max_allowed_packet=100M
Copy after login

Alternatively, you can adjust these settings within a MySQL console connected to the server:

set global net_buffer_length=1000000;
set global max_allowed_packet=1000000000;
Copy after login

Additional Precautions

  • Ensure that both client and server settings are modified to prevent future errors.
  • Consider increasing the packet size to a sufficiently large value to accommodate large data inserts.
  • If you are unsure about the optimal size, you can gradually increase the packet size until the error is resolved.

The above is the detailed content of How to Fix MySQL Error 1153: Maximum Packet Size Exceeded?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template