Make WordPress Core

Opened 3 years ago

Last modified 4 months ago

#58505 new defect (bug)

Using WORDPRESS_DB_HOST variable Cannot connect to the database, must be configu

Reported by: chentc Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version: 6.2.2
Severity: major Keywords: needs-patch
Cc: Focuses:

Description

I use kubernetes to run wordpress, and configure the WORDPRESS_DB_HOST variable, but it can not connect to the database, manually configure the database IP can be, mast have i to manually configure?
I also tried using docker and 'WORDPRESS_DB_HOST' didn't work either.
The image I used is wordpress:php8.2

Change History (2)

#1 @cafenoirdesign
3 years ago

  • Keywords needs-patch added; needs-refresh removed

#2 @jdeep
4 months ago

Hi @chentc,

I tried to reproduce the issue you were facing on Docker but couldn't. Can you share a bit more on what your configurations look like and how you set the WORDPRESS_ env vars? If you could share your docker-compose.yml or Kubernetes manifests, that would be helpful.

If I have to take a guess, I think your real issue is related to container networking. For example, if your database is running on Docker's default bridge network instead of a custom user-defined network, Docker's internal DNS won't automatically resolve container names. This means setting WORDPRESS_DB_HOST to a container name will fail, but using the raw database IP bypasses DNS entirely and connects successfully.See more here.

Note: See TracTickets for help on using tickets.