how to #39;load data infile#39; on amazon 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 上“加载数据文件"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在亚马逊 RDS 上“加载数据文件"?
基础教程推荐
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01