mysql的导入
方法1
load data [local] infile 'filename' into table tablename[option]
ields terminated by 'string'(字段分隔符,默认为字表符'\t');
fields [optionally] enclosed by 'char'(字段引用符,如果加optionally选项择只能用在char,varchar,text等字符型字段上,默认不使用引用符)
fields escaped by 'char' (转义字符,默认为'\')
lines staring by 'string' 每行前都加此字符串,默认''
lines terminated by 'string' 行结束符,默认为'\n'
ignore number lines 忽略输入文件中的前n行数据
实例
load data infile '/tmp/emp.txt' into table emp fields terminated by ',' enclosed by '"' ignore 2 lines;
只是加载部分列或者更改列的顺序
load data infile '/tmp/emp.txt' into table emp fields terminated by ',' enclosed by '"' ignore 2 lines (列名);
方法2:
mysqlimport
mysqlimport -uroot -p [--LOCAL] dbname 文件文件 [option]