You need to enable JavaScript to run this app.
文档中心
云数据库 MySQL 版

云数据库 MySQL 版

复制全文
下载 pdf
账号与访问授权
创建 IAM 身份验证策略
复制全文
下载 pdf
创建 IAM 身份验证策略
您的数据库账号验证方式为 IAM 验证,并希望通过此账号访问 MySQL 实例时,需要先配置 IAM 身份验证策略,确保 IAM 用户可以成功通过临时 Token 访问指定 MySQL 实例。​
前提条件​
操作步骤​
  1. 使用主账号登录访问控制台。​
  1. 在左侧导航栏,单击策略管理。进入策略管理页面。​
  1. 在策略管理页面,新建自定义策略。语法如下:​
​
{​
"Statement": [​
{​
"Effect": "Allow",​
"Action": [​
"rds_mysql:ConnectDatabase"​
],​
"Resource": [​
"trn:rds_mysql:*:<账号 ID>:instance/<实例 ID>/dbaccountname/<数据库账号>"​
]​
}​
]​
}​
​
在实际业务中,您需要将账号 ID、实例 ID、数据库账号替换为实际值。您可以参考权限策略示例,根据业务的具体使用场景,创建自定义权限策略。​
权限策略示例​
示例一:允许用户使用 IAM 数据库身份验证连接访问指定实例中的一个数据库账号​
​
{​
"Statement": [​
{​
"Effect": "Allow",​
"Action": [​
"rds_mysql:ConnectDatabase"​
],​
"Resource": [​
"trn:rds_mysql:*:21000xxxx:instance/mysql-b469b9axxxx/dbaccountname/testdb"​
]​
}​
]​
}​
​
示例二:允许用户使用 IAM 数据库身份验证连接访问指定实例中的多个数据库账号​
​
{​
"Statement": [​
{​
"Effect": "Allow",​
"Action": [​
"rds_mysql:ConnectDatabase"​
],​
"Resource": [​
"trn:rds_mysql:*:21000xxxx:instance/mysql-b469b9axxxx/dbaccountname/testdb",​
"trn:rds_mysql:*:21000xxxx:instance/mysql-b469b9axxxx/dbaccountname/testdemo"​
]​
}​
]​
}​
​
示例三:允许用户使用 IAM 数据库身份验证连接访问所有数据库实例和数据库账号​
​
{​
"Statement": [​
{​
"Effect": "Allow",​
"Action": [​
"rds_mysql:ConnectDatabase"​
],​
"Resource": [​
"trn:rds_mysql:*:21000xxxx:instance/*/dbaccountname/*"​
]​
}​
]​
}​
​
示例四:允许用户使用 IAM 数据库身份验证连接访问含有指定数据库账号的所有实例​
​
{​
"Statement": [​
{​
"Effect": "Allow",​
"Action": [​
"rds_mysql:ConnectDatabase"​
],​
"Resource": [​
"trn:rds_mysql:*:21000xxxx:instance/*/dbaccountname/testdemo"​
]​
}​
]​
}​
​
最近更新时间:2026.06.08 15:23:41
这个页面对您有帮助吗?
有用
有用
无用
无用