Enable MySQL server on Ubuntu to transfer large data by updating size limit¶
When you save or query large data (like 100MB+) on MySQL, MySQL may raise an error like Packet Too Large
which means that the statement SQL is too big or the received rows are too big.
Edit configuration file¶
On Ubuntu, the configuration file is by default at /etc/mysql/mysql.conf.d/mysqld.cnf
. You can update this file to increase size limit.
Here's an example:
[mysqld]
max_allowed_packet = 256M
In the example, max_allowed_packet
is updated to 256M. The maximum value is 1024M.
On some docker images, the default value is 4MB which is a bit small.
This article is originally created by tooli.top. Please indicate the source when reprinting : https://www.tooli.top/posts/mysql_large_data
Posted on 2022-06-04
Mail to author