This question already has answers here:
How can I import a large (14 GB) MySQL dump file into a new MySQL database?
(11 answers)
Closed 3 years ago.
"I am trying to import a backup file to MySQL. The file is 10GB but the problem I get an error when the backup reach the limit of max_allowed_packet which is: 1GB. Any idea how can I increase this number to 10GB ?"
I've tried to use this command:
mysql -u username -p database_name < file.sql
But i get the same error
I expect that i have to change the max_allowed_packet and net_buffer_length but how could i do that ?
Thank you!
Set the max_allowed_packet and net_buffer_length through mysql command line client
set global net_buffer_length=10000000;
set global max_allowed_packet=10000000000;
Related
This question already has answers here:
How do I import an SQL file using the command line in MySQL?
(54 answers)
Closed 4 years ago.
I'm trying to restore the empty DB for mydb table but the syntax of mysqlimport doesn't seem to be straight forward. I had earlier created the file emptyDbs when doing a mysqldump.
mysqlimport mydb/var/tmp/emptyDbs
mysql statsdb < /var/tmp/emptyDbs
I want to load a large .sql file (1.5GB) but everytime it stuck on 623.9 MB with the error: MySQL server has gone away.
Running the following command: mysql -u {DB-USER-NAME} -p {DB-NAME} < {db.file.sql path}
Already changed my my.cnf file with the following values, but that did not help:
wait_timeout = 3600
max_allowed_packet = 100M
innodb_lock_wait_timeout = 2000
What am I missing here?
Refer to this link -
MySQL Server has gone away when importing large sql file -
for various combinations that have worked for this problem.
This question already has answers here:
How do I restore a dump file from mysqldump?
(19 answers)
Closed 5 years ago.
I'm new to MySQL, and I accidentally dropped a table with approx 3gb worth of data. Good news, I think I have a backup file .dump. Now is there an easy way to import this file to my MySQL?
mysql -u username -p databse_name < backup.sql
This question already has answers here:
MySQL Error 1153 - Got a packet bigger than 'max_allowed_packet' bytes
(15 answers)
Closed 9 years ago.
for import mysql database give me this error :
$ `mysql -u user -p password zxc_db < zxc.sql`
ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes
Please give me a best solution to solve it ?
tanx .
the best solution is " change mysql.cnf "
debian :
/etc/mysql/mysql.cnf
change this line ==> max_allowed_packet = 16M
to : max_allowed_packet = 128M
or
add --max_allowed_packet=128M to your mysqldump command.
mysql --max_allowed_packet=128M -u user -ppass database < database.sql
My application download mails over IMAP and stores them in a MySQL database. Earlier I was supporting mails size upto 10 MB and hence a 'mediumtext' column to store the mail content was enough. Now I need to support mails upto 30MB. So I changed the datatype for the column to 'largetext'. Yesterday a mail with size 25 MB was stored. After that whenever I execute mysqldump command it throws error:
mysqldump: Error 2020: Got packet bigger than 'max_allowed_packet' bytes when dumping table `ib_mailbox_backup` at row: 3369
Row 3369 contains the 25 MB mail.
In MySQL config I increased the 'max_allowed_packet' from 64M to 512M and it still fails with the same error. Executing the mysqldump command on the same machine where MySQL server is running. How do I solve this?
You can add --max_allowed_packet=512M to your mysqldump command.
Or add max_allowed_packet=512M to [mysqldump] section of your my.cnf (thanks #Varun)
Note: it will not work if it is not under the [mysqldump] section...
Some of my scripts stopped working after an upgrade to Debian 9 & MariaDB.
MariaDB on Debian introduces a new config file specifically for mysqldump settings (/etc/mysql/conf.d/mysqldump.cnf). If you had set a max_allowed_packet <> 16M in your standard /etc/mysql/my.cnf previously, the new config file will overwrite that setting. So be sure to check this new config file and either delete the entry or adjust it to your needs.
I'm not sure if the change was introduced by the swap from MySQL to MariaDB or if Debian made a change in how the config files are laid out in V9.
I had a similar error and would fail with packet size 512M on row 0. It was an innodb table that was apparently damaged (mysqlcheck showed OK). I ended up re-creating the table and then it worked fine with a small packet size of just 128M.
This Work For me.
mysqldump --max_allowed_packet=512M --routines=true -u [user] [database] > [route and File name].sql