Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I import a large (14 GB) MySQL dump file into a new MySQL database?

How can I import a large (14 GB) MySQL dump file into a new MySQL database?

like image 664
TRN 7 Avatar asked Dec 05 '12 06:12

TRN 7


People also ask

How do I dump a large MySQL database?

To dump entire databases, do not name any tables following db_name , or use the --databases or --all-databases option. To see a list of the options your version of mysqldump supports, issue the command mysqldump --help .


2 Answers

I've searched around, and only this solution helped me:

mysql -u root -p  set global net_buffer_length=1000000; --Set network buffer length to a large byte number  set global max_allowed_packet=1000000000; --Set maximum allowed packet size to a large byte number  SET foreign_key_checks = 0; --Disable foreign key checking to avoid delays,errors and unwanted behaviour  source file.sql --Import your sql dump file  SET foreign_key_checks = 1; --Remember to enable foreign key checks when procedure is complete! 

The answer is found here.

like image 162
Kresimir Plese Avatar answered Oct 05 '22 02:10

Kresimir Plese


Have you tried just using the mysql command line client directly?

mysql -u username -p -h hostname databasename < dump.sql 

If you can't do that, there are any number of utilities you can find by Googling that help you import a large dump into MySQL, like BigDump

like image 31
Brian Campbell Avatar answered Oct 05 '22 04:10

Brian Campbell