首页 >数据库 >mysql教程 >随手记mysql_MySQL

随手记mysql_MySQL

WBOY
WBOY原创
2016-06-01 13:11:371004浏览

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