mysql - 如何在 RDS 副本实例中创建临时表

标签 mysql amazon-web-services amazon-rds database-replication

我的开发人员要求我能够创建 Temporary Tables .

但是他们配置的连接连接到一个RDS Read Replica Instance .

我如何设置权限以便他们的连接可以在该实例中创建临时表?

最佳答案

使用具有'ALL' 权限 的用户连接到您的ma​​ster RDS 实例,并创建一个tmp 数据库作为存储点临时表:

create database if not exists tmp;

SELECTCREATE TEMPORARY TABLES 分配给您的副本用户的连接:

grant SELECT, CREATE TEMPORARY TABLES ON tmp.* TO youruser@'%';

现在,您可以通过副本连接操作临时表:

create temporary table tmp.my_temporary_table
  select 
    mt.id
  from my_databaes.my_table as mt
  limit 10;

select * from tmp.my_temporary_table;

drop temporary table tmp.my_temporary_table;

关于mysql - 如何在 RDS 副本实例中创建临时表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37440177/

相关文章:

Mysql期间列和连接表

mysql - Mysql中的用户和报表表查询

java - 下载文件流而不是文件

amazon-web-services - s3 存储桶策略的策略 ID 有何作用?

amazon-web-services - AWS secret 管理器

python - 列出今天使用 Boto 3 创建的 RDS 快照

mysql - 如何将MySql数据库迁移到Firestore

mysql - 如何使用 chef solo 设置 MySQL root 密码而不以明文形式存储?

amazon-web-services - toomanyrequests : You have reached your pull rate limit. 你可以通过认证和升级来增加限制

java - 使用 JDBC 设置高 maxPoolSize 时需要注意哪些风险/因素