Home >Database >Mysql Tutorial >随手记mysql_MySQL

随手记mysql_MySQL

WBOY
WBOYOriginal
2016-06-01 13:11:371012browse

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



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn