这里是我的情况。我有我的当前数据库(我们称之为current_db)是最新的,但它的数据是不完整的,因为最近的崩溃。一些数据已删除,这个删除从2年前到昨天。
Here's my situation. I've got my current database (let's call it current_db) that is up to date, but its data are incomplete because of a recent crash. Some datas have been deleted, and this delete goes from 2 years ago to yesterday.
我有一个数据库的备份(我们称之为backup_db),从11月2013年,其数据已完成到2013年11月。由于current_db从2013年11月到2014年2月之间有一些数据,我不想只是废弃它,并从备份工作。所以我想导入current_db到backup_db忽略重复的数据。
I've got a backup of this database (let's call it backup_db), from November 2013, whose datas are complete up to November 2013. Since current_db holds some data from between November 2013 and February 2014, I don't want to just scrap it, and work from the backup. So I'd like to import current_db into backup_db ignoring duplicated data.
我已经搜索方法,但没有找到任何相关的。我遇到了一些SELECT查询,但他们都是简单的。我的数据库有20个表,我真的没有看到自己建立一个巨大的查询来导入所有这些。是否有其他方法?
I've seached for methods to do that, but couldn't find any relevant ones. I've come across a few SELECT queries, but they're all simplistic ones. My database holds 20 tables, and I don't really see myself building an immense query to import all of this. Is there any other way ?
感谢
推荐答案
可能的问题:
-
phpmyadmin中的最大文件上传大小可能为2MB。要解决此问题,请增加最大文件上传大小php.ini
The max file upload size in phpmyadmin may be 2MB.To solve this increase the maximum file upload size php.ini
假设您有模式s1和模式s2。
s1中的表格到s2中的表格中,而覆盖现有的行,可以使用:
To insert all rows of a table in s1 into a table in s2, while overwriting existing lines, you can use:
REPLACE INTO s2.table_name SELECT * FROM s1.table_name;如果您不想触摸现有的行:
If you do not want to touch existing lines:
INSERT INTO s2.table_name SELECT * FROM s1.table_name ON DUPLICATE KEY IGNORE;如果您有任何问题,请在此留言。
Comment here if you have any issues.
更多推荐
如何合并两个相同结构的MySQL数据库
发布评论