【发布时间】:2020-02-20 19:08:26
【问题描述】:
我正在尝试使用此连接字符串将我的云运行容器连接到我的 PostgreSQL 11 数据库
postgresql+psycopg2://username:password@/db?host=/cloudsql/project-name:region:dbinstance
当我尝试运行我的容器时,它会返回此错误
2019-10-24 13:30:53.910 CEST sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not connect to server: Connection refused
2019-10-24 13:30:53.910 CEST Is the server running locally and accepting
2019-10-24 13:30:53.910 CEST connections on Unix domain socket "/cloudsql/project-name:region:dbinstance/.s.PGSQL.5432"?
2019-10-24 13:30:53.910 CEST(Background on this error at: http://sqlalche.me/e/e3q8)
我也尝试过使用这个连接字符串
postgresql+psycopg2://username:password@/db?unix_socket=/cloudsql/project-name:region:dbinstance
返回此错误消息
2019-10-24 11:11:43.733 CESTsqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) invalid dsn: invalid connection option "unix_socket"
2019-10-24 11:11:43.733 CEST(Background on this error at: http://sqlalche.me/e/f405)
2019-10-24 11:11:44.469 CESTContainer called exit(1).
【问题讨论】:
标签: python postgresql google-cloud-platform google-cloud-run