如何在亚马逊RDS上“加载数据文件"? [英] how to 'load data infile' on amazon RDS?

查看:71
本文介绍了如何在亚马逊RDS上“加载数据文件"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定这是否是一个更适合于serverfault的问题,但是最近我一直在与Amazon RDS纠缠不清,并且在为我的Web主机mysql用户获取文件"特权时遇到麻烦.

not sure if this is a question better suited for serverfault but I've been messing with amazon RDS lately and was having trouble getting 'file' privileges to my web host mysql user.

我认为这很简单:

grant file on *.* to 'webuser@'%';

可以工作,但是不能,而且我似乎也无法对我的"root"用户执行此操作.是什么赋予了?我们使用加载数据的原因是因为它一次执行数千次插入操作的速度非常快.

would work but it does not and I can't seem to do it with my 'root' user as well. What gives? The reason we use load data is because it is super super fast for doing thousands of inserts at once.

有人知道如何解决这个问题,还是我需要找到其他方法?

anyone know how to remedy this or do I need to find a different way?

此页面 http://docs.amazonwebservices .com/AmazonRDS/latest/DeveloperGuide/index.html?Concepts.DBInstance.html 似乎建议我需要找到其他解决方法.

This page, http://docs.amazonwebservices.com/AmazonRDS/latest/DeveloperGuide/index.html?Concepts.DBInstance.html seems to suggest that I need to find a different way around this.

帮助?

更新 我不是要导入数据库-我只想使用文件加载选项来一次插入数十万行.

UPDATE I'm not trying to import a database -- I just want to use the file load option to insert several hundred-thousand rows at a time.

深入研究这就是我们拥有的:

after digging around this is what we have:

 mysql> grant file on *.* to 'devuser'@'%';
 ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)


 mysql> select User, File_priv, Grant_priv, Super_priv from mysql.user;
 +----------+-----------+------------+------------+
 | User     | File_priv | Grant_priv | Super_priv |
 +----------+-----------+------------+------------+
 | rdsadmin | Y         | Y          | Y          |
 | root     | N         | Y          | N          |
 | devuser  | N         | N          | N          |
 +----------+-----------+------------+------------+

推荐答案

您需要使用LOAD DATA LOCAL INFILE,因为该文件不在MySQL服务器上,而是在您从中运行命令的计算机上.

You need to use LOAD DATA LOCAL INFILE as the file is not on the MySQL server, but is on the machine you are running the command from.

根据下面的评论,您可能还需要添加标志:

As per comment below you may also need to include the flag:

--local-infile=1

这篇关于如何在亚马逊RDS上“加载数据文件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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