Maison >base de données >tutoriel mysql >随手记mysql_MySQL

随手记mysql_MySQL

WBOY
WBOYoriginal
2016-06-01 13:11:371005parcourir

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



Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn