We want to copy a whole database along with its tables and data to another MySQL instance.
The database is called bank_development.
In the source machine
mysqldump -u root -p bank_development > ayo.sql
Take the file ayo.sql to the target machine.
In the target machine
Start the MySQL client from the same folder with ayo.sql.
mysql -u root -p
Create the database schema,
CREATE DATABASE bank_development;
use it,
use bank_development;
and make the actual migration.
source ./ayo.sql
That’s it!
Review
This is a comfortable way for a developer to move/copy/backup his database.
Advertisements
very nice
Thanks! That works!