I imported a MySQL dump and got the following error.
$ mysql foo < foo.sql
ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes
Apparently there is an attachment in the database, which is making the insert very large. This is on my local machine, a Mac with MySQL 5 installed from the MySQL package. Where do I change the max_allowed_packet to be able to import the dump?
Is there anything else I need to set?
Just running mysql --max_allowed_packet=32M
produces the same error.
Solutip
You may have to change it for the client (you run to do the import) AND the mysqld daemon that runs and receives the import.
For clients, you can specify it on the command line:
mysql --max_allowed_packet=100M -u root -p database < dump.sql
Also, modify the my.cnf or my.ini file (usually found in /etc/mysql/
) under the mysqld section and set:
max_allowed_packet=100M
or you can run this command in a MySQL console connected to the same server:
set global net_buffer_length=1000000;
set global max_allowed_packet=1000000000;
(Use a very large value for the packet size.)
Resolve Error: Got a packet bigger than 'max_allowed_packet' bytes
Hii guys, I just encountered an error in the form of an error that reads;
MySQL: Got a packet bigger than 'max_allowed_packet' bytes
This happened when I imported a fairly large SQL file, around hundreds of MB, and the funny thing is that I changed the configuration in php.ini related to max_size upload, memory, etc., even though this was an error due to the configuration in my.cnf.
Oh yeah, as a note that in this case I'm using Ubuntu Linux, so for those of you who are using Windows, please adjust it yourself, you should understand the concept.
Okay, no need to beat around the bush anymore, just open the lampp/etc/my.cnf file or you can also go through the MySQL settings in the XAMPP GUI.
CTRL+F to search for "max_allowed_packet" change the value to a bigger value, whatever you like.
Restart xampp and Done!
How to Add Upload Size PHP MyAdmin
I can't change the file size that phpmyadmin accepts to import a database on my test server.
I've changed all the values I know of in my.cnf :
max_packet_size
Key_buffer
or the size and max_post_size
value of the uploaded file in each php.ini
file I find in the system.
The received file size on the import screen is still 8,192kib.
Solutip
The first thing to check (or ask your host to check) is the value of max_execution_time
, upload_max_file size
, memory_limit
and in the php.inipost_max_size
configuration file . These three settings limit the maximum size of data that PHP can send and handle.
Please note that post_max_size
it must be greater than upload_max_file size
.
Create info.php page and check all details about the file
<?php
phpinfo();
?>
Run it in your browser, search upload_max_file size
and post_max_size
change the default value of 2M to 80M.
To increase the size of the phpmyadmin MySQL import file in Ubuntu 16.04 or later, follow these steps. In the latest versions of Ubuntu you can have PHP 5 or PHP 7.
Step - 1: open php.ini appropriate PHP version.
For PHP v5.0
sudo -H gedit /etc/php5/apache2/php.ini
For PHP v7.0
sudo -H gedit /etc/php/7.0/apache2/php.ini
For PHP v7.1
sudo -H gedit /etc/php/7.1/apache2/php.ini
For PHP v7.2
sudo -H gedit /etc/php/7.2/apache2/php.ini
For PHP v7.3
sudo -H gedit /etc/php/7.3/apache2/php.ini
Step – 2: Now need to increase below parameters in php.ini file.
memory_limit = 1500M
post_max_size = 1500M
upload_max_filesize = 1500M
Please Note: post_max_size
must be greater than upload_max_size
Step - 3: Now you need to restart your apache server to make changes.
sudo service apache2 restart