mysql 命令行导入导出txt数据文件

1.数据导出命令

SELECT * FROM table [where condition]''  into  outfile 'D:/xxx.txt'

FIELDS
TERMINATED BY '\t'
[OPTIONALLY] ENCLOSED BY ''
ESCAPED BY '\\' 
LINES 
TERMINATED BY '\n'

 

2.数据导入命令

LOAD DATA INFILE 'D:/xxx.txt' INTO TABLE table_name

FIELDS
TERMINATED BY '\t'
[OPTIONALLY] ENCLOSED BY ''
ESCAPED BY '\\'
LINES
TERMINATED BY '\n'

 

注意:上述都是按照tab分割字段,按照行分割记录,使用时请根据自身数据情况改变。这些命令简单应用足够,复杂应用请参照mysql命令或者使用第三方工具

 

 

 

你可能感兴趣的:(mysql)