TL;DR: 在 Google Cloud Console 中创建用户后,不要忘记 REVOKE cloudsqlsuperuser@% FROM your-user@%;如果您只想让该用户访问特定模式。
通过 Google Cloud Console 创建 MySQL 用户会自动添加 cloudsqlsuperuser 角色,该角色允许用户访问该 MySQL 实例上的所有内容:
显示 user-from-gcp-console@% 的补助金;
+------------------------------------------------ ------------+
|授予 user-from-gcp-console@% |
+------------------------------------------------ ------------+
|将 . 的使用权授予 `user-from-gcp-console`@`%` |
|将 `cloudsqlsuperuser`@`%` 授予 `user-from-gcp-console`@`%`|
+------------------------------------------------ ------------+
Google 在其知识库的关于 MySQL 用户文章中提到了这一点。
要创建只能访问一种架构的用户,您需要通过运行以下命令来创建没有控制台的用户:
创建用户“您的用户”@“%”已识别
使用“<a style="color:f0; text-decoration:underline;" href="https://www.zvvq.cn/zt/11112.html" target="_blank">mysql</a>_native_password”
BY ;
将 your-schema. 上的所有内容授予 your-user@%;
或者通过控制台创建用户,但不要忘记删除 cloudsqlsuperuser 角色:
// 通过 Google Cloud Console 创建用户
从“您的用户”@“%”中撤销“cloudsqlsuperuser”@“%
将 your-schema. 上的所有内容授予 your-user@%;
以上就是创建只能访问 CloudSQL 中一个架构的用户的详细内容,更多请关注其它相关文章!