Ecommerce Shopify WordPress Discussion

Docker wordpress and mysql : Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /var/www/html/wp-includes/class-wpdb.php

I am trying to setup a local website on my Mac with Docker and the following docker-composer.yml file: version: '3' services: db: platform: linux/x86_64 image: mysql:5.7 ports: - "3306:3306" volumes: - wordpress_db:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} MYSQL_DATABASE: ${MYSQL_DATABASE} MYSQL_USER: ${MYSQL_USER} MYSQL_PASSWORD: ${MYSQL_PASSWORD} wordpress: image: wordpress:php7.4-apache depends_on: - db ports: - "8000:80" volumes: - ./:/var/www/html environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: ${MYSQL_USER} WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD} WORDPRESS_DB_NAME: ${MYSQL_DATABASE} volumes: wordpress_db: WORDPRESS DB constants are defined in a .env file. Running docker-composer up -d is OK, and I can enter my database using a GUI like Sequel Ace. But when I go to the website on http://localhost:8000 I get this error : Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /var/www/html/wp-includes/class-wpdb.php on line 1987 No such file or directory I tried switching localhost to for the DB_HOST constant in the wp-config.php file but it does not work either. Instead of the "No such file or directory" message I get : Warning: mysqli_real_connect(): (HY000/2002): Connection refused in /var/www/html/wp-includes/class-wpdb.php on line 1987 Connection refused What hostname should I use for Wordpress to connect to the database?
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.