简体   繁体   中英

Mysql LOAD DATA LOCAL INFILE works in mysql console but not in php scripts

after a few tweaks I've managed to enable LOAD DATA LOCAL INFILE in my phpmyadmin.

However, when I try the same query in php scripts, I get "The used command is not allowed with this MySQL version"

I already tried removing the "LOCAL" word but it doesn't work in mysql console either then, probably due to permission issues

I've already tried adding "128" at the end of the mysql_connect command, and apparmor is not running on the server so I'm out of ideas..

I managed to solve it thus:

  1. grant privileges in mysql
  2. edit open_basedir settings in order to be able to write in /tmp/
  3. use the /tmp/ folder to store the csv
  4. tell mysql to read /tmp/file.csv

For some reasons I couldn't use LOCAL, but this last-resort worked

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM