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 上“加载数据文件"?
- 更改自动增量起始编号? 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- SQL 临时表问题 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01