mysql load data infile 导入 csv 文件

load data infile '/home/user/OK3a/WW.txt' into table dmpa_test fields terminated by ',';

ERROR 1045 (28000): Access denied for user 'pguser'@'%' (using password: YES)
ERROR 1146 (42S02): Table 'QGDB.dmpa_test' doesn't exist
ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
show variables like '%secure%';
sudo mv /home/user/OK3a/WW.txt /var/lib/mysql-files/
load data infile '/var/lib/mysql-files/WW.txt' into table dmpa_test fields terminated by ',';
ERROR 1262 (01000): Row 1 was truncated; it contained more data than there were input columns
load data infile '/var/lib/mysql-files/00.txt' into table dmpa_test fields terminated by ',';

show variables like 'sql_mode';
load data infile '/var/lib/mysql-files/00.txt' into table dmpa_test fields terminated by ',' enclosed by '"';
[Err] 1262 - Row 1 was truncated; it contained more data than there were input columns
load data infile '/var/lib/mysql-files/00.txt' into table dmpa_test fields terminated by ',' optionally enclosed by "'" lines terminated by '\r\n' IGNORE 1 LINES ;
[Err] 1262 - Row 371126 was truncated; it contained more data than there were input columns

参考:
https://www.cnblogs.com/waynechou/p/7794939.html

标签: none

添加新评论