所以我想从我的实时数据库更新我的数据库的dev版本,我已经导出了实时数据库的模式,当我尝试将它导入到dev数据库时,它会给出错误,表示这些表已经存在。这些表中包含数据,我不想丢失,执行完整数据转储需要太长时间而且不需要。我只需要将实时数据库中的新列放到我的dev数据库中,有没有办法将所有较新的列大量导入到dev数据库表中?
答案 0 :(得分:1)
我建议看看mysqldiff utility。这是一个"which compares the data structures (i.e. schema / table definitions) of two MySQL databases, and returns the differences as a sequence of MySQL commands"工具。
这个工具的源代码(perl)是hosted on Github。此工具已有 Ubuntu 和 Debian 软件包。
manpage 中有很好的例子:
# compare table definitions in two files
mysqldiff db1.mysql db2.mysql
# compare table definitions in a file 'db1.mysql' with a database 'db2'
mysqldiff db1.mysql db2
注意这个工具只处理数据结构,而不是数据本身。
其他 SQL 数据库也有类似的实用程序(例如 pgdiff 用于 Postgresql)。