使用Mercurial进行Mysql备份 [英] Mysql Backup with Mercurial

查看:84
本文介绍了使用Mercurial进行Mysql备份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以服用吗?我在Google进行了研究,发现的文章很少,但是用德语和其他语言撰写,所以不太了解.

is it possible to take ? I researched at Google, I found few articles, but in German and other langs, so didnt understand well.

如果我们可以使用Mercurial [在localhost]将mysql从服务器备份到localhost,那就太好了.也许使用远程Mysql连接等.您知道这样做的任何方法吗?有可能吗?

It would be great if we could get mysql back-up from server to localhost with Mercurial [at localhost]. maybe with Remote Mysql Connection, etc. do you know any way of doing this? is it possible?

谢谢!问候...

推荐答案

假定您要将定期备份存储在版本控制存储库中,请执行以下三个步骤:

Presuming you want to store a periodic backup in a version control repository there are three steps:

  1. 设置要在其中存储数据库快照的Mercurial存储库.

  1. Setup the mercurial repository where you want to store the database snapshots.

mkdir db-backup
hg init db-backup

  • 以文件格式获取数据库.最简单的方法是通过mysqldump.只是备份原始数据库表文件将无法正常工作,因为它们可能处于不一致状态.

  • Get the database in a file format. The simplest way is via mysqldump. Just backing up the raw database table files won't work as they may be in an inconsistent state.

    cd db-backup
    mysqldump -u username -p -h dbhost databasename > databasename.sql
    

  • 将数据库转储提交到版本控制存储库中,以防万一.

  • Commit the database dump into the version control repository, in your case mercurial.

    hg commit -A -m "committing database snapshot as at `date`"
    

  • 最后两个步骤可能是您想要自动化的.

    The last 2 steps are what you'll probably want to automate.

    这篇关于使用Mercurial进行Mysql备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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