mysql load file写法

LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE ‘file_name’
[REPLACE | IGNORE]
INTO TABLE tbl_name
[PARTITION (partition_name,…)]
[CHARACTER SET charset_name]
[{FIELDS | COLUMNS}
[TERMINATED BY ‘string’]
[[OPTIONALLY] ENCLOSED BY ‘char’]
[ESCAPED BY ‘char’]
]
[LINES
[STARTING BY ‘string’]
[TERMINATED BY ‘string’]
]
[IGNORE number {LINES | ROWS}]
[(col_name_or_user_var,…)]
[SET col_name = expr,…]

导入一个值以tab分割的txt文件的例子

mysql --local-infile=1 -uroot -p -Nse"load data local infile '/root/data.txt' into table mydb.mytable character set gbk fields terminated by '\t' ignore 1 lines"

你可能感兴趣的:(mysql,mysql)