LOAD DATA LOCAL INFILE not working in RDS
Asked Answered
E

1

1

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.

Eyecatching answered 10/4, 2016 at 5:17 Comment(5)
Try to check this solution: https://mcmap.net/q/47425/-mysql-enable-load-data-local-infileRefrigerator
probably #2221835 might helpHazardous
Thank you @alexander.polomodov. I will have a look into links providedEyecatching
Thanks @Naruto. I will have a look into the link you have providedEyecatching
Possible duplicate of Import CSV to mysql tableIntra
A
0

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
    
Ainslee answered 13/6, 2017 at 9:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.