gcloud sql users assign-roles

NAME
gcloud sql users assign-roles - updates a user's database roles in a given instance
SYNOPSIS
gcloud sql users assign-roles USERNAME --instance=INSTANCE, -i INSTANCE --type=TYPE [--async] [--database-roles=[ROLE,…]] [--host=HOST] [--revoke-existing-roles] [GCLOUD_WIDE_FLAG]
DESCRIPTION
Updates a user's database roles in a given instance with a specified username and host.
EXAMPLES
To grant database roles role1 and role2 for my-user in instance prod-instance, run:
gcloud sql users assign-roles my-user --instance=prod-instance --database-roles=role1,role2 --type=BUILT_IN

To revoke existing database roles and grant new database roles role3 and role4 for my-user in instance prod-instance, run:

gcloud sql users assign-roles my-user --instance=prod-instance --revoke-existing-roles --database-roles=role3,role4 --type=BUILT_IN
POSITIONAL ARGUMENTS
USERNAME
Cloud SQL username.
REQUIRED FLAGS
--instance=INSTANCE, -i INSTANCE
Cloud SQL instance ID.
--type=TYPE
Cloud SQL user's type. It determines the method to authenticate the user during login. See the list of user types at https://cloud.google.com/sql/docs/postgres/admin-api/rest/v1beta4/SqlUserType
OPTIONAL FLAGS
--async
Return immediately, without waiting for the operation in progress to complete.
--database-roles=[ROLE,…]
A comma-separated list of database roles to be assigned to the user. This option is only available for MySQL and PostgreSQL instances. You can include predefined Cloud SQL roles, like cloudsqlsuperuser, or your own custom roles. Custom roles must be created in the database before you can assign them. You can create roles using the CREATE ROLE statement for both MySQL and PostgreSQL.
--host=HOST
Cloud SQL user's hostname expressed as a specific IP address or address range. % denotes an unrestricted hostname. Applicable flag for MySQL instances; ignored for all other engines. Note, if you connect to your instance using IP addresses, you must add your client IP address as an authorized address, even if your hostname is unrestricted. For more information, see Configure IP.
--revoke-existing-roles
A boolean flag for revoking existing database roles from the user. This option is only available for MySQL and PostgreSQL instances.
GCLOUD WIDE FLAGS
These flags are available to all commands: --access-token-file, --account, --billing-project, --configuration, --flags-file, --flatten, --format, --help, --impersonate-service-account, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity.

Run $ gcloud help for details.

NOTES
These variants are also available:
gcloud alpha sql users assign-roles
gcloud beta sql users assign-roles