Home >Database >Mysql Tutorial >How to Efficiently Import a 14 GB MySQL Dump File into a New Database?

How to Efficiently Import a 14 GB MySQL Dump File into a New Database?

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2024-11-05 00:53:02949browse

How to Efficiently Import a 14 GB MySQL Dump File into a New Database?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn