A PHP library for migrating large MySQL databases by splitting tables into individual ZIP files, bypassing server timeouts and memory limits.
Anyone who has tried to move a large, multi-gigabyte MySQL database knows it's a nightmare. Standard "export/import" fails due to server timeouts and memory limits. I was facing this exact, frustrating problem.
I built a custom PHP tool to solve this. The script intelligently automates the process by exporting each table into its own compressed ZIP file. The corresponding restore script then imports each ZIP sequentially on the new server, completely bypassing server limitations and turning a painful manual task into a reliable, automated one.
- Backup and restore MySQL databases
- Support for splitting large tables
- Example scripts for backup and restore
Install via Composer:
composer require delhiarpitpatel/large-mysql-migrator
Or clone the repository and run composer install
:
git clone https://github.com/delhiarpitpatel/large-mysql-migrator.git
cd large-mysql-migrator
composer install
Simple one-liner for common operations:
require_once 'vendor/autoload.php';
use DelhiArpitPatel\LargeMysqlMigrator\MySQLMigrator;
MySQLMigrator::quickBackup("localhost", "username", "password", "database_name", "/backup/folder");
require_once 'vendor/autoload.php';
use DelhiArpitPatel\LargeMysqlMigrator\MySQLMigrator;
MySQLMigrator::quickRestore("localhost", "username", "password", "database_name", "/backup/folder");
use DelhiArpitPatel\LargeMysqlMigrator\MySQLMigrator;
$migrator = new MySQLMigrator("localhost", "username", "password");
$migrator->backup("database_name", "/backup/folder");
$migrator->restore("/backup/folder", "database_name");
Visit our documentation site for detailed guides and examples.
This project is licensed under the MIT License. See the LICENSE file for details.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Arpit Patel