Importing a Large (14 GB) MySQL Dump File into a New MySQL Database
Importing a massive database dump, such as one with a size of 14 GB, into a new MySQL database can be a daunting task. However, with the right approach, it is possible to tackle this challenge efficiently.
One highly recommended solution involves adjusting MySQL's network buffer length and maximum allowed packet size. This allows MySQL to handle larger data transfer sizes. Additionally, disabling foreign key checking during the import process helps prevent delays and errors, which improves the overall speed and stability of the import operation.
The following set of commands provides a step-by-step guide to achieve this:
mysql -u root -p set global net_buffer_length=1000000; set global max_allowed_packet=1000000000; SET foreign_key_checks = 0; source file.sql SET foreign_key_checks = 1;
By utilizing these commands, you can successfully import even large dump files into your new MySQL database, ensuring data integrity while optimizing performance.
The above is the detailed content of How to Efficiently Import a 14 GB MySQL Dump File into a New Database?. For more information, please follow other related articles on the PHP Chinese website!