数据库表 copy

db1为原数据库,db2为要导出到的数据库,fromtable 是要导出的表名

1.方法一:
登录导出到的数据库,执行
create table fromtable select * from db1.fromtable;
2.方法二:
在cmd下执行,mysqldump -u root -p db1 fromtable file=d:/fromtable.sql; 输入秘密,root为用户名
登录db2 执行 source d:/fromtable.sql;
3.方法三:
登录db1 执行 select * from fromtable into outfile "d:/fromtable .txt"; 导出纯数据格式
登录db2 执行 load data infile d:/fromtable .txt into table fromtable; 需要先建一张和原表结构一样的空表。
4.建一个odbc连接,先导出到access中,再导出到另一个库中。

原文地址:https://www.cnblogs.com/Struts-pring/p/5141398.html