Yerzhan
07/02/2022, 5:43 AMDATABASE_URL="postgresql://${GCP_SQL_USER}:${GCP_SQL_PASSWORD}@${GCP_SQL_HOST}:5432/${GCP_SQL_DB}
Takeo Kusama
07/02/2022, 5:57 AMpostgresql://${db_user_name}:${db_password}@localhost/${db_name}?${socket_path}.
If you use tcp
"postgresql://${user}:{password}@${host}:${port}/${db_ame}?schema=public"
.
Furthermore if you don’t open port (it’s recommended), your client server needs run cloud_sql_proxy as daemon.
Refer
https://cloud.google.com/sql/docs/postgres/connect-admin-proxy?hl=en
In rare case but, it happen to me, random generated password includes forbidden character like ‘$’. It translate shell variable after letter thus can cause break access data url.
If you can’t connect psql $DATABASE_URL
, it may happen.Takeo Kusama
07/02/2022, 6:02 AMYerzhan
07/02/2022, 7:15 AM:
character at the begging of password is prohibited. after I changed user password, I was able to connect.
Thank you!Edun omatseye
07/02/2022, 9:32 AM:
to start your password because the linter checks for :
to separate a username from the password in the connection string.