Mysql 如何在RDS副本实例中创建临时表
我的开发人员要求我能够创建 但他们配置的连接已连接到Mysql 如何在RDS副本实例中创建临时表,mysql,amazon-web-services,amazon-rds,database-replication,Mysql,Amazon Web Services,Amazon Rds,Database Replication,我的开发人员要求我能够创建 但他们配置的连接已连接到 如何设置权限,使其连接可以在该实例中创建临时表?打开与具有'ALL'权限的用户的连接,连接到您的主RDS实例,并创建tmp数据库作为临时表的存储点: create database if not exists tmp; create temporary table tmp.my_temporary_table select mt.id from my_databaes.my_table as mt limit 10;
如何设置权限,使其连接可以在该实例中创建临时表?打开与具有'ALL'权限的用户的连接,连接到您的主RDS实例,并创建
tmp
数据库作为临时表的存储点:
create database if not exists tmp;
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;
将选择
和创建临时表
分配给副本用户的连接:
grant SELECT, CREATE TEMPORARY TABLES ON tmp.* TO youruser@'%';
现在,通过复制副本连接,您可以操作临时表:
create database if not exists tmp;
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;
“写入连接”是什么意思?如何打开?@Andremoniy打开与具有“全部”权限的用户的连接。。或者至少有足够的权限来创建数据库和修改数据库上的权限。这通常是您的
根用户。(为了避免歧义,答案中的措辞发生了变化)啊,好的,它是mysql
。。。不适合Postgressem创建临时表但不更新它们。因此,它的用途有限。