首頁 >資料庫 >mysql教程 >随手记mysql_MySQL

随手记mysql_MySQL

WBOY
WBOY原創
2016-06-01 13:11:371005瀏覽

1,mysql: left, right, outer, inner, left outer, 以及 right outer.

2,导出数据:

mysql> SELECT * FROM tutorials_tbl     -> INTO OUTFILE '/tmp/tutorials.txt';#导出csv格式mysql> SELECT * FROM passwd INTO OUTFILE '/tmp/tutorials.txt'    -> FIELDS TERMINATED BY ',' ENCLOSED BY '"'    -> LINES TERMINATED BY '/r/n';

3,导入数据:mysqldump、load data和mysqlimport

#导出$ mysqldump -u root -p TUTORIALS tutorials_tbl > dump.txt#导入$ 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,将导出的数据直接导入到远程的服务器

$ mysqldump -u root -p database_name /       | mysql -h other-host.com database_name



陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn