如何比较 MySQL 数据库架构
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/876731/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to compare MySQL database schemas
提问by Shvilam
I am looking for a tool that will allow me to compare schemas of MySQL databases.
Which is the best tool to do that?
我正在寻找一种工具,可以让我比较 MySQL 数据库的模式。
哪个是最好的工具?
采纳答案by scottynomad
Navicat is able to do that for you. It will also synchronize schema and/or data between two mysql database instances. I've used it with success in the past.
Navicat 能够为您做到这一点。它还将在两个 mysql 数据库实例之间同步模式和/或数据。我过去曾成功地使用过它。
http://www.navicat.com/en/products/navicat_mysql/mysql_overview.html
http://www.navicat.com/en/products/navicat_mysql/mysql_overview.html
There is a screenshot of the data and structure synchronization tool here:
这里有数据和结构同步工具的截图:
http://www.navicat.com/en/products/navicat_mysql/mysql_detail_mac.html#7
http://www.navicat.com/en/products/navicat_mysql/mysql_detail_mac.html#7
回答by Joe Freeman
Perhaps a bit late to the party, but I've just written a simple tool in PHP to compare MySQL database schemas:
可能有点晚了,但我刚刚用 PHP 编写了一个简单的工具来比较 MySQL 数据库模式:
PHP script to compare MySQL database schemasHow to use the script
用于比较 MySQL 数据库架构的 PHP 脚本如何使用该脚本
It exports the schema and serialises it before doing the comparison. This is so that databases can be compared that reside on different hosts (where both hosts may not be accessible by the PHP script).
它导出模式并在进行比较之前将其序列化。这是为了可以比较驻留在不同主机上的数据库(PHP 脚本可能无法访问这两个主机)。
Edit:
编辑:
回答by Macros
I use SQLyog:
我使用 SQLyog:
It isn't free but is a very good tool and has saved the cost of it's license many many times over. I'm in no way affiliated with the company, just someone who has used a number of MySQL tools.
它不是免费的,但它是一个非常好的工具,并且多次节省了它的许可证成本。我与该公司没有任何关系,只是使用过许多 MySQL 工具的人。
Free trial(30-day) available from here.
可从此处获得免费试用(30 天)。
回答by James B
The best thing to do is to try out some performance benchmarks that are already out there. It's always better to use tried-and-tested benchmarks, unless you're thoroughly convinced that your data and database loading is going to be significantly different to the traditional usage patterns (but, then, what are you using a database for?). I'm going to steal my own answer from ServerFault:
最好的办法是尝试一些已经存在的性能基准。使用久经考验的基准测试总是更好,除非您完全相信您的数据和数据库加载将与传统使用模式有很大不同(但是,您使用数据库的目的是什么?)。我将从 ServerFault窃取我自己的答案:
There are a good number of benchmarks out there for different MySQL database engines. There's a decent one comparing MyISAM, InnoDB and Falcon on the Percona MySQL Performance Blog, see here.
Another thing to consider between the two aforementioned engines (MyISAM and InnoDB) are their approaches to locking. MyISAM performs table-locking, whilst InnoDB performs row-locking. There are a variety of things to consider, not only downright performance figures.
有很多针对不同 MySQL 数据库引擎的基准测试。Percona MySQL 性能博客上有一篇比较 MyISAM、InnoDB 和 Falcon 的文章,请参见此处。
在上述两个引擎(MyISAM 和 InnoDB)之间要考虑的另一件事是它们的锁定方法。MyISAM 执行表锁定,而 InnoDB 执行行锁定。有很多事情需要考虑,不仅仅是彻头彻尾的性能数据。