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
Mary-Kate OlsenOriginal
2024-12-06 22:55:18298browse

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

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

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;

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!

Statement:
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