Importing Large MySQL Dump Files into a New Database
When attempting to import a large MySQL dump file into a new database, errors can arise due to buffer size and packet size limitations. To resolve this issue, follow these steps:
-
Set Network Buffer Length: set global net_buffer_length=1000000; to increase the network buffer size.
-
Set Maximum Allowed Packet Size: set global max_allowed_packet=1000000000; to allow for larger packet sizes during the import process.
-
Disable Foreign Key Checking: SET foreign_key_checks = 0; to temporarily disable foreign key checking and prevent potential errors and delays.
-
Import the SQL Dump File: source file.sql; where "file.sql" represents the name of the dump file.
-
Re-enable Foreign Key Checking: SET foreign_key_checks = 1; to ensure database integrity once the import is complete.
Note: The solution was found on a reputable online forum and has proven to be effective in resolving large MySQL dump file import issues.
The above is the detailed content of How to Import Large MySQL Dump Files Without Errors?. 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