mysql表导出_MySQL表的导出

8a84655e84ce50e62548ba9dfea588d5.png

4729865326bc256cb1d024f0534361cf.png

select * from actor into outfile '/data/actor.text' fields terminated by "," enclosed by '"';

5f9b4aaa99f8e85d49a34fd90694237e.png

第一列是数值型,两边不加引号,则改为:

select * from actor into outfile '/data/actor1.text' fields terminated by "," optionally enclosed by '"';

43bb46de67b3dd116608693d8c15165a.png

导出不加引号,改为:

select * from actor into outfile '/data/actor2.text' fields terminated by "," optionally enclosed by '';

select * from actor into outfile '/data/actor3.text' fields terminated by "," ;

fd850f00ce442d0c2f820ded166de9b0.png

4b34aeab3415ead5f697e8773738939c.png

注意:

当导出命令中包含字段引用符时,数据中含有转义字符本身和字段引用符的字符需要被转义。

当导出命令中不包含字段引用符时,数据中含有转义字符本身和字段分割符的字符需要被转义。

select ... into outfile 产生的输出文件如果在目标目录下有重名文件,将不会创建成功,源文件不能被自动覆盖。

使用mysqldump导出:

mysql/bin> ./mysqldump -uroot -p -T /data sakila actor --fields-terminated-by ',';

222ad14cfe46ad28263ef93a3669b80b.png

ed929b29e5c864d88615697d3828a781.png

fa51889a04282d5192815bbd21e12015.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值