简体   繁体   English

有没有办法镜像本地和在线MySQL数据库?

[英]Is there a way to mirror local and online MySQL databases?

While doing web work, I've found it the fastest to run WAMP and work locally -- which has unavoidably resulted in the follow question: Is it possible to mirror (or very easily duplicate/clone) MySQL databases? 在进行网络工作时,我发现它是运行WAMP并在本地工作最快的方法-不可避免地导致了以下问题:是否可以镜像(或非常容易地复制/克隆)MySQL数据库?

The idea would be so I could work locally -- including database manipulation, and transfer all work online easily. 我的想法是让我可以在本地工作-包括数据库操作,并轻松地在线传输所有工作。

My apologies if this is a duplicate question -- I looked around on Stack Overflow and Google, but didn't really find anything. 如果这是一个重复的问题,我深表歉意。我环顾了Stack Overflow和Google,但并未真正找到任何东西。

可以使用称为MySQL Migration Toolkit的工具移动数据库,这可能会有所帮助。

Normally you won't want to duplicate the production data on a non-production system; 通常,您不希望在非生产系统上复制生产数据。 restoring it from a backup is normally sufficient. 从备份还原它通常就足够了。

However, you always want to duplicate the schema and other objects (stored procedures, views etc). 但是,您始终希望复制架构和其他对象(存储过程,视图等)。 This should not be a problem, as you will have scripted them entirely in your SCM repository, so you can just run the scripts on your test system, and you have an identical database structure to production. 这应该没问题,因为您将在SCM存储库中完全编写脚本,因此您可以在测试系统上运行脚本,并且拥有与生产相同的数据库结构。

If you have NOT scripted all your database objects, then you can't expect the test system to be useful; 如果您尚未编写所有数据库对象的脚本,那么您就无法期望测试系统会有用。 you need to ensure that all database schema is maintained as part of the app, in your SCM so that developers can make changes in a controlled way. 您需要确保在SCM中将所有数据库架构作为应用程序的一部分进行维护,以便开发人员可以以受控方式进行更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM