1. 新建一个数据库 dbNew, create database dbNew; use dbNew;2. 然后 创建表create table table1 like db1.table1; create table table2 like db1.table2;3. 复制数据insert into table1 select * from db1.table1; insert into table1 select * from db2.table1; ... insert into table1 select * from db17.table1;insert into table2 select * from db1.table2; insert into table2 select * from db2.table2; ... insert into table2 select * from db17.table2;
1. 新建一个数据库 dbNew,
create database dbNew;
use dbNew;2. 然后 创建表create table table1 like db1.table1;
create table table2 like db1.table2;3. 复制数据insert into table1 select * from db1.table1;
insert into table1 select * from db2.table1;
...
insert into table1 select * from db17.table1;insert into table2 select * from db1.table2;
insert into table2 select * from db2.table2;
...
insert into table2 select * from db17.table2;
如果没有重复,用MYSLDUMP导出再导入
有重复要麻烦一些,用SP取得所有表名,对表名 处理一下,比如加上原来的数据库名,再导入
在SCHEMATA中取得所有数据库名(游标 ),TABLES 中取得所有表名(游标 ),循环,再导入新的数据库中
1) 数据唯一性
2) 停机时间
3) 磁盘空间
4) 各个机器数据库配置差异
5) 各个库数据结构是否真的完全一致?[注: 不同时间由于不同原因大多数都会导致差异不可能一层不变]
6) 各个库是否使用了不同版本mysql [注: MySQL4.1前不同版本之间的兼容性很差]以上这些都是一些大的方向,具体操作小点自己注意一下.
我一向奉行宗旨是分开容易合并难;要重视和谨慎合并.