LOAD DATA INFILE within PHPmyadmin

2019-09-08 12:46发布

问题:

I'm running the following command within PHPmyadmin:

LOAD DATA INFILE '/test3.csv' INTO TABLE temp_car FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES (recloc,divdept)

AND

LOAD DATA INFILE '/var/www/vhosts/domain.com/httpdocs/admin/server/test3.csv' INTO TABLE temp_car FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' IGNORE 1 LINES (recloc,divdept)

i get this error:

#1045 - Access denied for user 'db_admin'@'%' (using password: YES) 

I've tried changing the permissions to the file to 777 and the containing folder to 777.

Any ideas? I'm having a terrible time getting a working test with LOAD DATA INFILE

回答1:

"For security reasons, when reading text files located on the server, the files must either reside in the database directory or be readable by all. Also, to use LOAD DATA INFILE on server files, you must have the FILE privilege."