MySQL——导出和导入csv文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#导出csv
SELECT * FROM 表的名称
INTO OUTFILE '文件路径.csv'
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '"'   
LINES TERMINATED BY '\r\n'; 
 
 
#导入csv
LOAD DATA INFILE '文件路径.csv'  
INTO TABLE 表的名称
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '"'  
LINES TERMINATED BY '\r\n';

Add a Comment

电子邮件地址不会被公开。 必填项已用*标注