MySQL 5.5 Gone Away

MySQLmysql-5.5

I'm trying to import a database in preparation for an upgrade from 5.0 to 5.5. The database isn't that large, only 37GB but I can't manage to import it without ERROR 2006. My most recent attempt when like this:

db01 # mysqldump -u root -p$password --databases $db --max_allowed_packet=2G --skip-extended-insert --add-drop-table  --force > /mydatabase.dmp

db02 # mysql --max_allowed_packet=2G -u root -p$password -e "source /mydatabase.dmp"
ERROR 2006 (HY000) at line 7292 in file: '/mydatabase.dmp': MySQL server has gone away

Here's my my.cnf:

[mysqld]
innodb_buffer_pool_size = 3G
server-id = 4
log_bin = /var/lib/mysql/mysql-bin.log
binlog_do_db = my_database
port = 3306
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

There is memory available on the server at the time – nothing else is running there. There's nothing in mysqld.log regarding this error. How can I get past this error?

Best Answer

There is a misunderstanding on how large max_allowed_packet may be.

According to the following URL, the MAX is 1G.

https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html