LOAD DATA LOCAL INFILE在RDS中不起作用 [英] LOAD DATA LOCAL INFILE not working in RDS

查看:252
本文介绍了LOAD DATA LOCAL INFILE在RDS中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有wordpress网站,并已创建插件以将csv导入表.数据库位于RDS中.这是我使用过的SQL

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

将DATA LOCAL INFILE'my.csv'加载到表表名中字符集UTF8字段以','封闭'\''以'\ r \ n'结束的行忽略1行

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, 姓名 地址 )

( ID, Name Address )

当我在同一数据库(RDS中的数据库)中的sqlyog中运行此sql时,它运行完美.请注意,使用的csv文件在我的Windows文件夹中,并提供了绝对路径.但是,当我从Linux服务器(托管网站的地方)上的插件运行此sql时,wordpress给出了一条消息,提示不支持加载数据本地文件".我有另一个网站,该网站可以正常运行,并且也可以托管在AWS上,并且具有相同的配置,例如RDS中的数据库和两台服务器上的mysql 5.5+版本.

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.

谢谢.

推荐答案

Amazon RDS托管服务不支持文件加载.因此它给出了错误.

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

因此,您无法加载CSV. 这是方法.

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

  1. 将您的CSV数据转换为插入表(....)SQL数据中.
  2. 使用以下命令加载数据.

  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

这篇关于LOAD DATA LOCAL INFILE在RDS中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆