是否将远程数据库同步到本地? [英] Syncing remote database to local?

查看:228
本文介绍了是否将远程数据库同步到本地?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我可以使用一个shell脚本,它将一个sql转储从我的生产站点拉入我的本地数据库.理想情况下,我希望能够运行以下内容:

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

sync_site example_com example_local

第一个参数是生产数据库,第二个参数是本地数据库.远程数据库始终位于SSH之后的同一服务器上,并且具有已知的MySQL凭据.

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.

推荐答案

弄清楚了:

ssh me@myserver.com mysqldump -u user -ppass remote_db | mysql -u user -ppass local_db

这篇关于是否将远程数据库同步到本地?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆