Erick
Erick

Reputation: 6089

MySQL synchronisation between 2 db

I am currently looking for a quick way to sync my production db and my dev-db.

I was thinking of doing it with something like this :

mysqladmin -u <user> -p<password> <dev-db_name> | mysqldump -u <user> -p<password> --databases <production-db-name> --add-drop-table

but it seems that it just prints all of the drump on the screen instead of piping it to the mysqladmin util. Would there be any suggestion to improve this ?

Upvotes: 0

Views: 210

Answers (2)

Varkhan
Varkhan

Reputation: 16751

You could also look into the master / slave replication paradigm... if you just need to read from the dev-db, this is perfect...

Upvotes: 0

andri
andri

Reputation: 11292

Right now you are piping the output of mysqladmin into mysqldump.

Flip them around, also instead of mysqladmin use regular mysql, to that the command like looks something like this:

mysqldump ... | mysql ...

Upvotes: 5

Related Questions