如何在亚马逊 RDS 上“加载数据文件"?

how to #39;load data infile#39; on amazon RDS?(如何在亚马逊 RDS 上“加载数据文件?)
本文介绍了如何在亚马逊 RDS 上“加载数据文件"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不确定这是否是一个更适合 serverfault 的问题,但我最近一直在使用 amazon RDS,并且无法将文件"权限授予我的网络主机 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 上“加载数据文件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)