ITPub博客

首页 > 数据库 > MySQL > MYSQL表的导入导出

MYSQL表的导入导出

原创 MySQL 作者:oraclesuperman 时间:2015-07-31 09:23:18 0 删除 编辑

mysql> select * from test into outfile '/tmp/test.txt' fields terminated by "," enclosed by '"';
Query OK, 16 rows affected (0.00 sec)


[root@dba ~]# cat /tmp/test.txt
"1","test1"
"2","test2"
"3","test3"
"4","test4"
"5","test5"
"6","test6"
"7","test7"
"8","test8"
"9","test9"
"10","test10"
"11","test11"
"12","test12"
"13","test13"
"14","test14"
"15","test15"
"16","test16"


mysql> select * from test into outfile '/tmp/test1.txt' fields terminated by "," optionally enclosed by '"';
Query OK, 16 rows affected (0.00 sec)



[root@dba ~]# cat /tmp/test1.txt
1,"test1"
2,"test2"
3,"test3"
4,"test4"
5,"test5"
6,"test6"
7,"test7"
8,"test8"
9,"test9"
10,"test10"
11,"test11"
12,"test12"
13,"test13"
14,"test14"
15,"test15"
16,"test16"

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29313086/viewspace-1757349/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: Mysql热备份
请登录后发表评论 登录
全部评论

注册时间:2015-03-20

  • 博文量
    178
  • 访问量
    422834