When i tried to import the MySQL database backup file on phpmyadmin error showed on page
“Error #import #1153 got a packet bigger than 'max_allowed_packet' bytes in phpmyadmin”
The reason is uploading packets receives bigger than max_allowed_packet bytes, So the best solution will be increasing max_allowed_packet size in mysql config. but not on php side,
This query shows you current values for allowed packet.
mysql> SHOW VARIABLES LIKE 'max_allowed_packet';
+--------------------------+-----------------+
| Variable_name | Value |
+--------------------------+-----------------+
| max_allowed_packet | 1048576 |
+---------------------------+-----------------+
1 row in set (0.09 sec)
+--------------------------+-----------------+
| Variable_name | Value |
+--------------------------+-----------------+
| max_allowed_packet | 1048576 |
+---------------------------+-----------------+
1 row in set (0.09 sec)
As we see above current settings allows 1 MB, If like to increase to 16 MB, execute this query,
Mysql> SET GLOBAL max_allowed_packet=16777216;
This can be done in other way too, by editing "my.cnf" which is in /etc/,
local@bash# vim /etc/my.cnf
[mysqld]
max_allowed_packet = 16M
[mysqld]
max_allowed_packet = 16M
Save the file and restart mysql to take effect.
local@host # /etc/init.d/mysqld restart
Incase you have installed xampp, restart mysql separately,
local@bash# /opt/lampp/lampp/ stopmysql
local@bash# /opt/lampp/lampp/ startmysql
local@bash# /opt/lampp/lampp/ startmysql
after changes can see it values of allowed packet.
mysql> SHOW VARIABLES LIKE 'max_allowed_packet';
+---------------------------+-------------------+
| Variable_name | Value |
+---------------------------+-------------------+
| max_allowed_packet | 16777216 |
+---------------------------+-------------------+
1 row in set (0.08 sec)
+---------------------------+-------------------+
| Variable_name | Value |
+---------------------------+-------------------+
| max_allowed_packet | 16777216 |
+---------------------------+-------------------+
1 row in set (0.08 sec)
You can easily import databases in MySQL.
Comments (0)