ERROR 1064 (42000): You have an error in your SQL syntax

mysql使用load data infile导入数据。出现如下错误:

root@NoName 21:19:12> load data infile /change.csv'  into table  change CHARACTER SET utf8 fields terminated by ',' optionally enclosed by '"' escaped by '"'  lines terminated by '\n' 
    -> (src_company_id,company_name,change_id,no,change_date,change_name,before,after,src_created_date,

src_updated_date);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL 

server version for the right syntax to use near 'before,after,src_created_date,src_updated_date)' at line 2
root@NoName 21:19:23>

原因在于,表字段使用了mysql保留字。mysql保留字网上很多,这里就不列举了。before、after就是其中之一。

解决方法,在字段名上用尖引号括起来。如下:

`before`,`after`

你可能感兴趣的:(mysql)