SELECT * FROM tutorials_tbl -> INTO OUTFILE '/tmp/tutorials.txt';#導(dǎo)出csv格式mysql> SELECT * FROM pa" />
2,導(dǎo)出數(shù)據(jù):
mysql> SELECT * FROM tutorials_tbl -> INTO OUTFILE '/tmp/tutorials.txt';#導(dǎo)出csv格式mysql> SELECT * FROM passwd INTO OUTFILE '/tmp/tutorials.txt' -> FIELDS TERMINATED BY ',' ENCLOSED BY '"' -> LINES TERMINATED BY '/r/n';
3,導(dǎo)入數(shù)據(jù):mysqldump、load data和mysqlimport
#導(dǎo)出$ mysqldump -u root -p TUTORIALS tutorials_tbl > dump.txt#導(dǎo)入$ mysql -u root -p database_name < dump.txt#load datamysql> LOAD DATA LOCAL INFILE 'dump.txt' INTO TABLE mytbl;mysql> LOAD DATA LOCAL INFILE 'dump.txt' INTO TABLE mytbl -> FIELDS TERMINATED BY ':' -> LINES TERMINATED BY '/r/n';mysql>LOAD DATA LOCAL INFILE 'dump.txt' -> INTO TABLE mytbl (b, c, a);$ mysqlimport -u root -p --local database_name dump.txt
4,將導(dǎo)出的數(shù)據(jù)直接導(dǎo)入到遠程的服務(wù)器
$ mysqldump -u root -p database_name / | mysql -h other-host.com database_name
聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com