Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import a 10GB file to MySQL? [duplicate]

Tags:

database

mysql

"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!

like image 815
Julien Avatar asked Nov 25 '25 04:11

Julien


1 Answers

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;
like image 98
Stanley Fernandes Avatar answered Nov 26 '25 20:11

Stanley Fernandes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!