同步2个MySQL服务器上的表
我有 2 台 MySQL 服务器:一台用于开发,另一台用于生产。两者都包含相同的表结构,但表上的数据不同。
当我在开发服务器上完成更改(例如向表添加列)时,我稍后手动对生产服务器进行了相同的更改。但这很慢并且容易出错,尤其是在需要同时进行许多更改的情况下。
有更好的方法吗?我有 phpMyAdmin,也许这有一些巧妙的技巧?
另外,这个过程有专门的术语吗?搜索“表更新”或类似内容不会产生有关此主题的结果。
编辑:
忘记提及我正在使用Windows。
所以显然我需要某种差异工具来实现这一点。我还没有测试所有这些建议的软件,但到目前为止它们似乎非常有用。
I have 2 MySQL servers: one for development, other for production. Both contain same table structure, but different data on tables.
When I have done change on dev server, like add column to table, I have manually made the same change later to production server. But this slow and error prone, especially if there are many changes to be made at once.
Is there better way to do this? I have phpMyAdmin, maybe that has some neat trick?
Also, is there a dedicated term for what this process is called? Searching for 'table update' or similar does not yield results on this topic.
EDIT:
Forgot to mention that I am using Windows.
So apparently I need some kind of diff tool for this. I haven't tested all of these proposed software yet, but so far they seem very useful.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我之前使用过 Red Gate 的 SQL Compare 来进行 SQL Server; 这是他们的 MySQL 产品。我自己没有预算购买它,但如果它像 SQL Compare 那样工作,它就会完全按照您的要求执行。
I've used Red Gate's SQL Compare before for SQL Server; this is their MySQL product. I don't have the budget to buy it myself, but if it works anything like SQL Compare did, it'll do exactly what you want it to do.
当我这样做时,我在一个名为 Navicat 的 Mysql GUI 应用程序中使用了数据或结构同步,有一个免费版本可用,它完美地满足了您的要求。
When ever I do this I have used the data or structure sync in a Mysql GUI app called Navicat, there is a free version available and it does what you asked perfectley.
尝试使用 dbForge Studio for MySQL 中的架构/数据比较器来比较和同步数据库。
Try to compare and synchronize databases with schema/data comparers in dbForge Studio for MySQL.