Syncing remote database to local?

隐身守侯 提交于 2019-12-03 06:19:21

问题


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 local_db


来源:https://stackoverflow.com/questions/4888604/syncing-remote-database-to-local

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!