<legend id='3QXMF'><style id='3QXMF'><dir id='3QXMF'><q id='3QXMF'></q></dir></style></legend>
    • <bdo id='3QXMF'></bdo><ul id='3QXMF'></ul>
  1. <i id='3QXMF'><tr id='3QXMF'><dt id='3QXMF'><q id='3QXMF'><span id='3QXMF'><b id='3QXMF'><form id='3QXMF'><ins id='3QXMF'></ins><ul id='3QXMF'></ul><sub id='3QXMF'></sub></form><legend id='3QXMF'></legend><bdo id='3QXMF'><pre id='3QXMF'><center id='3QXMF'></center></pre></bdo></b><th id='3QXMF'></th></span></q></dt></tr></i><div id='3QXMF'><tfoot id='3QXMF'></tfoot><dl id='3QXMF'><fieldset id='3QXMF'></fieldset></dl></div>

    <small id='3QXMF'></small><noframes id='3QXMF'>

      <tfoot id='3QXMF'></tfoot>

      比较两个 MySQL 数据库

      时间:2023-08-19
        <tfoot id='0wWpq'></tfoot>

            <small id='0wWpq'></small><noframes id='0wWpq'>

            • <bdo id='0wWpq'></bdo><ul id='0wWpq'></ul>
                <tbody id='0wWpq'></tbody>
              <i id='0wWpq'><tr id='0wWpq'><dt id='0wWpq'><q id='0wWpq'><span id='0wWpq'><b id='0wWpq'><form id='0wWpq'><ins id='0wWpq'></ins><ul id='0wWpq'></ul><sub id='0wWpq'></sub></form><legend id='0wWpq'></legend><bdo id='0wWpq'><pre id='0wWpq'><center id='0wWpq'></center></pre></bdo></b><th id='0wWpq'></th></span></q></dt></tr></i><div id='0wWpq'><tfoot id='0wWpq'></tfoot><dl id='0wWpq'><fieldset id='0wWpq'></fieldset></dl></div>
              <legend id='0wWpq'><style id='0wWpq'><dir id='0wWpq'><q id='0wWpq'></q></dir></style></legend>

              1. 本文介绍了比较两个 MySQL 数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我目前正在使用 MySQL 数据库开发应用程序.

                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?

                答案中提到的工具:

                • Red-Gate 的 MySQL Schema &数据比较(商业)
                • Maatkit(现为 Percona)
                • liquibase
                • 蟾蜍
                • Nob Hill 数据库比较(商业)
                • MySQL 差异
                • SQL EDT(商业)
                • Red-Gate's MySQL Schema & Data Compare (Commercial)
                • Maatkit (now Percona)
                • liquibase
                • Toad
                • Nob Hill Database Compare (Commercial)
                • MySQL Diff
                • SQL EDT (Commercial)

                推荐答案

                如果您使用的是小型数据库,我发现在两个数据库上都使用 --skip-comments--skip-extended-insert 选项来生成 SQL 脚本,然后在 SQL 脚本上运行 diff 效果很好.

                If you're working with small databases I've found running mysqldump on both databases with the --skip-comments and --skip-extended-insert options to generate SQL scripts, then running diff on the SQL scripts works pretty well.

                通过跳过注释可以避免无意义的差异,例如运行 mysqldump 命令的时间.通过使用 --skip-extended-insert 命令,您可以确保使用自己的插入语句插入每一行.这消除了单个新记录或修改记录可能导致所有未来插入语句中的连锁反应的情况.使用这些选项运行会产生更大的转储,没有注释,所以这可能不是你想要在生产使用中做的事情,但对于开发来说应该没问题.我在下面列出了我使用的命令示例:

                By skipping comments you avoid meaningless differences such as the time you ran the mysqldump command. By using the --skip-extended-insert command you ensure each row is inserted with its own insert statement. This eliminates the situation where a single new or modified record can cause a chain reaction in all future insert statements. Running with these options produces larger dumps with no comments so this is probably not something you want to do in production use but for development it should be fine. I've put examples of the commands I use below:

                mysqldump --skip-comments --skip-extended-insert -u root -p dbName1>file1.sql
                mysqldump --skip-comments --skip-extended-insert -u root -p dbName2>file2.sql
                diff file1.sql file2.sql
                

                这篇关于比较两个 MySQL 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:内爆一个在 python MySQLDB IN 子句中使用的列表 下一篇:MySQL:授予**所有**数据库权限

                相关文章

                最新文章

                  <i id='4YGYZ'><tr id='4YGYZ'><dt id='4YGYZ'><q id='4YGYZ'><span id='4YGYZ'><b id='4YGYZ'><form id='4YGYZ'><ins id='4YGYZ'></ins><ul id='4YGYZ'></ul><sub id='4YGYZ'></sub></form><legend id='4YGYZ'></legend><bdo id='4YGYZ'><pre id='4YGYZ'><center id='4YGYZ'></center></pre></bdo></b><th id='4YGYZ'></th></span></q></dt></tr></i><div id='4YGYZ'><tfoot id='4YGYZ'></tfoot><dl id='4YGYZ'><fieldset id='4YGYZ'></fieldset></dl></div>

                  • <bdo id='4YGYZ'></bdo><ul id='4YGYZ'></ul>
                1. <tfoot id='4YGYZ'></tfoot>

                  <small id='4YGYZ'></small><noframes id='4YGYZ'>

                  <legend id='4YGYZ'><style id='4YGYZ'><dir id='4YGYZ'><q id='4YGYZ'></q></dir></style></legend>