0

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 ?

2 Answers 2

5

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 ...
Sign up to request clarification or add additional context in comments.

3 Comments

I just tried and got this error on the first table mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table acces at row: 1388 any idea ?
Hm. Try dumping into a file first, that is, without piping it straight to mysql client, do something like "mysqldump ... > script.sql" and see if that succeeds.
Seems to be the way to go. Thanks for the tip :-)
0

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

1 Comment

Yup but problem is 1- it's relatively complicated 2- cpanel 3- I need to only sync sometimes, not each night (in case I test db manipulations and I want to keep it the next day). But otherwise, great idea :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.