Syncing remote database to local?
问题 I'm hoping I can use a shell script that will pull a sql dump down from my production site and into my local database. Ideally, I'd like to be able to run something like this: sync_site example_com example_local Where the first argument is the production database and the second is the local database. The remote database is always on the same server, behind SSH, with known MySQL credentials. 回答1: Figured it out: ssh me@myserver.com mysqldump -u user -ppass remote_db | mysql -u user -ppass