Compare two MySQL databases [closed]

2018-12-31 12:45发布

I'm currently developing an application using a MySQL database.

The database-structure is still in flux and changes while development progresses (I change my local copy, leaving the one on the test-server alone).

Is there a way to compare the two instances of the database to see if there were any changes?

While currently simply discarding the previous test server database is fine, as testing starts entering test data it could get a bit tricky.
The same though more so will happen again later in production...

Is there an easy way to incrementally make changes to the production database, preferably by automatically creating a script to modify it?


Tools mentioned in the answers:

21条回答
忆尘夕之涩
2楼-- · 2018-12-31 13:07

check: http://schemasync.org/ the schemasync tool works for me, it is a command line tool works easily in linux command line

查看更多
伤终究还是伤i
3楼-- · 2018-12-31 13:08

I use a piece of software called Navicat to :

  • Sync Live databases to my test databases.
  • Show differences between the two databases.

It costs money, it's windows and mac only, and it's got a whacky UI, but I like it.

查看更多
何处买醉
4楼-- · 2018-12-31 13:08

For the first part of the question, I just do a dump of both and diff them. Not sure about mysql, but postgres pg_dump has a command to just dump the schema without the table contents, so you can see if you've changed the schema any.

查看更多
无与为乐者.
5楼-- · 2018-12-31 13:09

Toad for MySQL has data and schema compare features, and I believe it will even create a synchronization script. Best of all, it's freeware.

查看更多
查无此人
6楼-- · 2018-12-31 13:10

dbSolo, it is paid but this feature might be the one you are looking for http://www.dbsolo.com/help/compare.html

It works with Oracle, Microsoft SQL Server, Sybase, DB2, Solid, PostgreSQL, H2 and MySQL alt text

查看更多
心情的温度
7楼-- · 2018-12-31 13:11

For myself, I'd start with dumping both databases and diffing the dumps, but if you want automatically generated merge scripts, you're going to want to get a real tool.

A simple Google search turned up the following tools:

查看更多
登录 后发表回答