LOAD DATA LOCAL INFILE not working in RDS

好久不见. 提交于 2019-12-13 02:40:01

问题


I have wordpress website and have created plugin to import csv to a table. Database is in RDS. Here is the sql I have used

LOAD DATA LOCAL INFILE 'my.csv' INTO TABLE tablename CHARACTER SET UTF8 FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES

( ID, Name Address )

When I run this sql in sqlyog in the same database ( database in RDS ) this works perfectly. Please note csv file used is on my windows folder and given absolute path. However when I run this sql from the plugin on the linux server (where the website is hosted), wordpress gives message saying Load data local infile is not supported. I have another website where this works fine and this is also hosted on AWS as this one and has the same configuration such as database in RDS and mysql version 5.5+ on both servers.

Am I missing anything here. Any help will be appreciated.

Thanks in advance.


回答1:


Amazon RDS hosted service doesn't support the load from files. Hence it gives error.

Hence, you can't load the CSV. Here is approach.

  1. Convert your CSV data into insert into table(....) SQL data.
  2. Load your data using command like below.

     mysql -h <Host> -u <username> -p<Password> < Your_file.sql
    


来源:https://stackoverflow.com/questions/36526102/load-data-local-infile-not-working-in-rds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!