No error code is returned when importing csv files from a local wamp: Repeated replace=tablenewcardcharactersetutf8fieldsterminatedbyenclosedbylinesterminatedbyrn ('code ')
No error code is returned when importing csv files from the local wamp: load data infile '/opt/htdocs/www/reply replace into table newcardCHARACTER SET utf8FIELDS terminated by ''encodingby' \ "'Lines terminated by' \ r \ n' ('Code ') upload
No error code is returned when importing csv files from the local wamp:
LOAD DATA INFILE '/opt/htdocs/www/xxx.com/xxx/public/upload/53a7d83f00e08b4f0121d80f.csv' REPLACE INTO TABLE newcardCHARACTER SET utf8FIELDS TERMINATED BY '' ENCLOSED BY '\"'LINES TERMINATED BY '\r\n' (`code`)
Reported when uploaded to the server
Access denied.
Later I checked the cause because the database server and the file server are not on the same machine and need to use "LOAD DATA LOCAL INFILE ".
So I changed the code
LOAD DATA LOCAL INFILE '/opt/htdocs/www/xxx.com/xxx/public/upload/53a7d83f00e08b4f0121d80f.csv' REPLACE INTO TABLE newcardCHARACTER SET utf8FIELDS TERMINATED BY '' ENCLOSED BY '\"'LINES TERMINATED BY '\r\n' (`code`)
ReportWarning: PDO: exec (): load data local infile forbidden in/opt/htdocs/www/xxx.com/xxx/public/test.php on line 12
Later, google launched a solution in load-data-local-infile-forbidden-in-php.
You can solve the problem by passing the following parameters during pdo initialization.
\PDO::MYSQL_ATTR_LOCAL_INFILE => true
Reprinted, please note: the blog of Jesus. Pan» PDO import CSV, "load data local infile" error Solution
The error message "load data local infile" is returned when PDO imports CSV files. It was first published in the blog of Jesus. Pan.