Skip to content

Can't connect to database, even though I can connect to database! #545

@secoldPrivate

Description

@secoldPrivate

My current setup is using wordpress with Kubernetes, and a google cloud SQL server.
The Cluster has a cloudproxy setup (which basically makes it 'virtually' seem like the database is available within the cluster.

I've got the environment variables set correctly but when the container starts it says:

PHP Warning:  mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 

MySQL Connection Error: (2002) Connection refused 

I know the hostname, password, and such are correct in the environment variables:

  WORDPRESS_DB_HOST: <hostname>
  WORDPRESS_DB_USER: <username>
  WORDPRESS_DB_PASSWORD: <password>

I know this because I can exec into the container, install a mysql client, and connect to the remote database USING those environment variables!

But for some reason with wordpress starts up it can't connect.
I'm unsure how to debug this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions