[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-03 UTC。"],[[["\u003cp\u003eThis guide details how to create and manage users and roles within AlloyDB Omni, extending beyond the default PostgreSQL settings.\u003c/p\u003e\n"],["\u003cp\u003eNew PostgreSQL users can be created with privileges such as \u003ccode\u003eCREATE ROLE\u003c/code\u003e, \u003ccode\u003eCREATEDB\u003c/code\u003e, and \u003ccode\u003eLOGIN\u003c/code\u003e, mirroring the \u003ccode\u003epostgres\u003c/code\u003e user's capabilities.\u003c/p\u003e\n"],["\u003cp\u003eUser privileges can be modified with \u003ccode\u003eALTER ROLE\u003c/code\u003e, passwords can be changed with \u003ccode\u003eALTER USER\u003c/code\u003e, roles can be granted with \u003ccode\u003eGRANT\u003c/code\u003e, and revoked with \u003ccode\u003eREVOKE\u003c/code\u003e using \u003ccode\u003epsql\u003c/code\u003e client commands.\u003c/p\u003e\n"],["\u003cp\u003eDatabase users can be created for direct authentication using usernames and passwords or through Identity and Access Management.\u003c/p\u003e\n"],["\u003cp\u003eTo delete a user, any objects owned by the user must be dropped or reassigned, and any granted privileges must be revoked before using the \u003ccode\u003eDROP ROLE\u003c/code\u003e command.\u003c/p\u003e\n"]]],[],null,["# Manage AlloyDB Omni users and roles\n\nSelect a documentation version: 16.3.0keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/database-users/manage-users)\n- [16.8.0](/alloydb/omni/16.8.0/docs/database-users/manage-users)\n- [16.3.0](/alloydb/omni/16.3.0/docs/database-users/manage-users)\n- [15.12.0](/alloydb/omni/15.12.0/docs/database-users/manage-users)\n- [15.7.1](/alloydb/omni/15.7.1/docs/database-users/manage-users)\n- [15.7.0](/alloydb/omni/15.7.0/docs/database-users/manage-users)\n\n\u003cbr /\u003e\n\nThis page describes how to create and manage AlloyDB Omni users and roles.\n\n\u003cbr /\u003e\n\nIn addition to the default users and roles that come with PostgreSQL, you can create other PostgreSQL users or roles. These users have the same set of\nprivileges as the `postgres` user:\n`CREATE ROLE`,\n`CREATEDB`, and `LOGIN`. For more information about these\nprivileges, see [`CREATE ROLE`](https://www.postgresql.org/docs/16/sql-createrole.html).\n\nYou can change the privileges of any user by using the [`ALTER ROLE`](https://www.postgresql.org/docs/16/sql-alterrole.html) command. If you create a new user with the `psql` client, you can\nchoose to associate it with a different role, or assign different privileges.\n\nBefore you begin\n----------------\n\nTo use PostgreSQL commands to manage users on a cluster, you need the following:\n\n- Access to the `psql` client\n- Access to the `postgres` database user, or another user with the appropriate administrative privileges\n\nCreate a database user\n----------------------\n\nTo create a database user that authenticates with the database directly using\na username and password---also known as *built-in authentication*--- use the following command: \n\n CREATE USER \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eUSERNAME\u003c/span\u003e\u003c/var\u003e WITH PASSWORD '\u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e';\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e: The user role's username.\n\n- \u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e: The new password to assign to the\n user role.\n\nFor more information about how to create and define database users, see [`CREATE\nUSER`](https://www.postgresql.org/docs/16/sql-createuser.html).\n\nAfter you create a user or a role, you can change its privileges by using the [`ALTER\nROLE`](https://www.postgresql.org/docs/16/sql-alterrole.html) command\nin the `psql` client.\n\nGrant roles to a database user\n------------------------------\n\nTo grant roles to a database user, use the following command: \n\n GRANT \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eROLE\u003c/span\u003e\u003c/var\u003e to \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eUSERNAME\u003c/span\u003e\u003c/var\u003e;\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eROLE\u003c/var\u003e: The role to grant to the database user.\n\n- \u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e: The new password to assign to the\n user role.\n\nTo give a user superuser privileges, grant that user the `alloydbsuperuser` role.\n\nChange the password of a database user\n--------------------------------------\n\nTo set a new password for a standard PostgreSQL database user, use the following command: \n\n ALTER USER \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eUSERNAME\u003c/span\u003e\u003c/var\u003e WITH PASSWORD '\u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e';\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eUSERNAME\u003c/var\u003e: The database user's username.\n\n- \u003cvar translate=\"no\"\u003ePASSWORD\u003c/var\u003e: The new password to assign to the\n user role.\n\nFor more information about changing a user's password, see [`ALTER ROLE`](https://www.postgresql.org/docs/16/sql-alterrole.html).\n\nRevoke a role from a database user\n----------------------------------\n\nTo revoke a previously granted privilege from one or more roles, or to revoke a\nuser's membership in a role, use the following command: \n\n REVOKE \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-k\"\u003eROLE\u003c/span\u003e\u003c/var\u003e FROM \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eUSERNAME\u003c/span\u003e\u003c/var\u003e;\n\nTo remove a user's superuser privileges, revoke the `alloydbsuperuser` role\nfrom that user.\n\nView a list of database users\n-----------------------------\n\nTo view a table of all database users and their group memberships, use the following command: \n\n \\du\n\nDelete a database user\n----------------------\n\nBefore deleting a user, you must drop all the objects it owns or reassign their\nownership, and revoke any privileges the role has been granted on other objects.\n\nTo delete a user, use the following command: \n\n DROP ROLE \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eUSERNAME\u003c/span\u003e\u003c/var\u003e;"]]