csv 导 mysql
csv 导库命令
eg :
load data local infile ' /home/chengqinglong/ 2yd.csv' into table
test_ssid fields terminated by ',' optionally enclosed by '\"' escaped by '\"' lines terminated by '\r\n'
查阅
Now load your CSV using LOAD DATA LOCAL INFILE
,we need to use --local-infile
before we loadCSV
in in new MySQL vesrsions, due to security reasons.
格式:
- # MySQL中导入导出数据时,使用CSV格式时的命令行参数
- # 在导出数据时使用:select ... from ... [where ...] into outfile '/tmp/data.csv' $MYSQL_CSV_FORMAT;
- # 在导入数据时使用:load data infile '/tmp/data.csv' into table ... $MYSQL_CSV_FORMAT;
- # CSV标准文档:RFC 4180
- MYSQL_CSV_FORMAT="fields terminated by ',' optionally enclosed by '\"' escaped by '\"' lines terminated by '\r\n'"