Importing large MySQL databases can pose a challenge, particularly with the risk of connection timeouts. This article explores effective strategies to address this issue during development.
1. PHPMyAdmin Import
a) Check and adjust MySQL ini settings (e.g., max_allowed_packet, read_buffer_size) to increase import limits.
b) Modify PHP.ini settings (e.g., max_execution_time, memory_limit) to extend PHP limits during import.
2. Using Big Dump Staggered MySQL Dump Importer
a) Download and use the Big Dump script to split import into smaller blocks, overcoming timeout issues.
3. MySQL Console
a) Access the MySQL console (e.g., through WAMP control panel).
b) Use the use command to specify the target database.
c) Execute the source command followed by the SQL file path to import the database.
MySQL Workbench: Another option for importing large databases with a user-friendly interface.
Disabling Foreign Key Constraints: To avoid errors during import, consider temporarily disabling foreign key constraints using the following MySQL syntax:
SET FOREIGN_KEY_CHECKS=0;
SET FOREIGN_KEY_CHECKS=1;
The above is the detailed content of How to Avoid Connection Timeouts When Importing Large MySQL Databases?. For more information, please follow other related articles on the PHP Chinese website!