通过以下命令可以导入指定文件格式的数据到mysql表中:
代码语言:javascript复制LOAD DATA LOCAL INFILE '/tmp/002.txt'
INTO TABLE user_info
CHARACTER SET utf8
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY ''
LINES TERMINATED BY 'n'(name,age,address,gender);
文件/tmp/002.txt格式内容如下:
代码语言:javascript复制name,age,address,gender
Byron.Y.Y,17,Shenzhen.Guangdong.China,M