当使用"将数据加载到outfile"时如何转义(\ t \ n \ r);在mysql中?
我试过这样做:
select * from user INTO OUTFILE FIELDS TERMINATED BY '\t' ESCAPED BY '\\' LINES TERMINATED BY '\n'
但似乎不起作用
我需要一个例子。
如果我在字段var
中插入一个内容为" \ r \ n"
+----+------+------+
| id | var | var2 |
+----+------+------+
| 1 |
| test |
+----+------+------+
然后,运行
SELECT * FROM `test` into OUTFILE '/tmp/out.log' FIELDS TERMINATED BY '\t' ESCAPED BY '\\' LINES TERMINATED BY '\r\n';
' out.log':
1 \
test
ASCII:
31 09 5c 0d 0a 09 74 65 73 74 0d 0a
但我想逃避0d 0a
答案 0 :(得分:0)
select * from user INTO OUTFILE 'path' FIELDS TERMINATED BY '\t' ESCAPED BY '\\' LINES TERMINATED BY '\r\n';