When connecting to a Google Cloud SQL instance, is there a way to specify the database I want to connect to?
This is the command I execute and the error I get:
gcloud sql connect
does not currently allow you to specify the database name. There is a open issue to add it: https://issuetracker.google.com/issues/69314375
In the meantime, you can work around this by utilizing the PGDATABASE
environment variable:
e.g.
PGDATABASE=mydb gcloud sql connect myinstance
You could create a shell alias to do this for you.