我目前正在开发一个使用MySQL数据库的应用程序。

数据库结构在开发过程中仍在变化和变化(我更改本地副本,只保留测试服务器上的副本)。

是否有一种方法可以比较数据库的两个实例,以查看是否有任何更改?

虽然目前简单地丢弃之前的测试服务器数据库是可以的,但是随着测试开始输入测试数据,这可能会变得有点棘手。 同样的情况会在以后的制作中再次发生……

是否有一种简单的方法来增量地对生产数据库进行更改,最好是自动创建一个脚本来修改它?


答案中提到的工具:

Red-Gate的MySQL模式和数据比较(商用) Maatkit(现为Percona) liquibase 蟾蜍 Nob Hill数据库比较(商业) MySQL Diff SQL EDT(商用)


当前回答

我正在与Nob Hill的营销团队合作,我想告诉你,我很高兴听到你的问题,建议或其他任何东西,请随时与我联系。

We originally decided to create our tool from scratch because while there are other such products on the market, none of them do the job right. It’s quite easy to show you the differences between databases. It’s quite another to actually make one database like the other. Smooth migration, both of schema and data, has always been a challenge. Well, we have achieved it here. We are so confident that it could provide you a smooth migration, than if it doesn’t – if the migration scripts it generates are not readable enough or won’t work for you, and we can’t fix it in five business days – you will get your own free copy!

http://www.nobhillsoft.com/NHDBCompare.aspx

其他回答

在网上搜索了几个小时后,我发现我没有在Ubuntu软件中心寻找简单的工具。 以下是我找到的一个免费解决方案: http://torasql.com/ 他们声称也有Windows版本,但我只在Ubuntu下使用。

编辑:2015 - 2月- 05 如果你需要Windows工具,TOAD是完美的和免费的: http://software.dell.com/products/toad-for-mysql/

在SQLyog(商业)中有一个模式同步工具,它可以生成用于同步两个数据库的SQL。

我用一个叫Navicat的软件:

同步Live数据库到我的测试数据库。 显示两个数据库之间的差异。

它要花钱,只能在windows和mac上使用,界面也很古怪,但我喜欢。

就我个人而言,我将从转储两个数据库开始,并对转储进行差异处理,但如果您希望自动生成合并脚本,则需要使用真正的工具。

简单的谷歌搜索可以找到以下工具:

MySQL工作台,有社区版(OSS)和商业版。 Nob Hill数据库比较,免费提供MySQL。 其他SQL比较工具的列表。

我正在与Nob Hill的营销团队合作,我想告诉你,我很高兴听到你的问题,建议或其他任何东西,请随时与我联系。

We originally decided to create our tool from scratch because while there are other such products on the market, none of them do the job right. It’s quite easy to show you the differences between databases. It’s quite another to actually make one database like the other. Smooth migration, both of schema and data, has always been a challenge. Well, we have achieved it here. We are so confident that it could provide you a smooth migration, than if it doesn’t – if the migration scripts it generates are not readable enough or won’t work for you, and we can’t fix it in five business days – you will get your own free copy!

http://www.nobhillsoft.com/NHDBCompare.aspx