kodeops/laravel-mysql-dumper
_ _ _____ ______ _______ _____ _____ _______
|____/ | | | \ |______ | | |_____] |______
| \_ |_____| |_____/ |______ |_____| | ______|
kodeops/laravel-mysql-dumper
Dump and restore the contents of a MySQL database.
Install
Add composer dependency
composer require kodeops/laravel-mysql-dumper
Add database connection settings to the environment file
The SOURCE prefix indicates the database settings where the dump will be generated from:
MYSQL_DUMPER_DESTINATION_HOST=
MYSQL_DUMPER_DESTINATION_PORT=
MYSQL_DUMPER_DESTINATION_DATABASE=
MYSQL_DUMPER_DESTINATION_USERNAME=
MYSQL_DUMPER_DESTINATION_PASSWORD=
The DESTINATION prefix indicates the database settings where the dump will be imported:
MYSQL_DUMPER_SOURCE_HOST=
MYSQL_DUMPER_SOURCE_PORT=
MYSQL_DUMPER_SOURCE_DATABASE=
MYSQL_DUMPER_SOURCE_USERNAME=
MYSQL_DUMPER_SOURCE_PASSWORD=
Example:
MYSQL_DUMPER_DESTINATION_HOST=127.0.0.1
MYSQL_DUMPER_DESTINATION_PORT=3306
MYSQL_DUMPER_DESTINATION_DATABASE=destination-database
MYSQL_DUMPER_DESTINATION_USERNAME=root
MYSQL_DUMPER_DESTINATION_PASSWORD=secret
MYSQL_DUMPER_SOURCE_HOST=127.0.0.1
MYSQL_DUMPER_SOURCE_PORT=3306
MYSQL_DUMPER_SOURCE_DATABASE=source-database
MYSQL_DUMPER_SOURCE_USERNAME=root
MYSQL_DUMPER_SOURCE_PASSWORD=secret
Using the command line
Cloning the source database to the destination database
php artisan mysql-dumper:clone
Exporting the source database to a file
php artisan mysql-dumper:export
Importing a dump file to the destination database
php artisan mysql-dumper:import /home/vagrant/app/storage/laravel-mysql-dumper/test.sql
Production safe
The command is not available in production environments unless you add the --force option:
php artisan mysql-dumper:clone
Dump storage
All dumps are located in the laraval storage path in laravel-mysql-dumper folder:
/home/vagrant/app/storage/laravel-mysql-dumper
Related Packages
laravel 中轻松容易的输出完整的 SQL 语句。 - Easy output of complete SQL statemen...
Laravel database export package with profile-based exclusions, anonymization, an...
Create database dumps ready to be used with Codeception
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| 0.3.3 | ^7.1.3| | MIT | |
| 0.3.2 | ^7.1.3| | MIT | |
| 0.3.1 | ^7.1.3 | MIT | |
| 0.3 | ^7.1.3 | MIT | |
| 0.2 | ^7.1.3 | MIT | |
| 0.1.5 | ^7.1.3 | MIT | |
| 0.1.4 | ^7.1.3 | MIT | |
| 0.1.3 | ^7.1.3 | MIT | |
| 0.1.2 | ^7.1.3 | MIT | |
| 0.1.1 | ^7.1.3 | MIT | |
| 0.1 | ^7.1.3 | MIT |