mysql load data 乱码

时间:2021-12-28 03:29:38

解决方案:  http://*.com/questions/26256421/sql-load-data-infile-utf8-issue

即:

load data local infile '/path/to/sqlfile'
into table xxx
character set utf8
fields terminated by ','
lines terminated by '\n';

into table xxx 后紧接着指定字符集 character set utf8;

/path/to/sqlfile 放在/etc/my.cnf 文件datadir定义的路径下, 传值传相对路径。