mysql数据导入导出

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

若是但愿将db1的数据导入到db2中,有以下方法:sql

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;cmd


3.方法三:
登陆db1 执行 select * from fromtable into outfile "d:/fromtable .txt"; 导出纯数据格式
登陆db2 执行 load data infile d:/fromtable .txt into table fromtable; 须要先建一张和原表结构同样的空表。table


4.建一个odbc链接,先导出到access中,再导出到另外一个库中。登录

相关文章
相关标签/搜索