mysql怎樣將一個數(shù)據(jù)庫中的數(shù)據(jù)導入到另一個數(shù)據(jù)庫中
1 回答

泛舟湖上清波郎朗
TA貢獻1818條經(jīng)驗 獲得超3個贊
db1為原數(shù)據(jù)庫,db2為要導出到的數(shù)據(jù)庫,fromtable 是要導出的表名
1.方法一:
登錄導出到的數(shù)據(jù)庫,執(zhí)行
create table fromtable select * from db1.fromtable;
2.方法二:
在cmd下執(zhí)行,mysqldump -u root -p db1 fromtable file=d:/fromtable.sql; 輸入秘密,root為用戶名
登錄db2 執(zhí)行 source d:/fromtable.sql;
3.方法三:
登錄db1 執(zhí)行 select * from fromtable into outfile "d:/fromtable .txt"; 導出純數(shù)據(jù)格式
登錄db2 執(zhí)行 load data infile d:/fromtable .txt into table fromtable; 需要先建一張和原表結(jié)構(gòu)一樣的空表。
4.建一個odbc連接,先導出到access中,再導出到另一個庫中。
添加回答
舉報
0/150
提交
取消