Docker compose wordpres: "cannot select database"

Its my first time doing a post like this so, if i postet it in the wrong category or somthing say it.

so i just installed wordpress on docker.
when i go on the domain/ip its sayn " Cannot select database"
i installed it through a docker compose script:

version: ‘3.3’
services:
db:
image: mysql:5.7
volumes:
- /root/wordpress:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: password
wordpress:
depends_on:
- wordpress db
image: wordpress:latest
ports:
- “83:80”
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: password
WORDPRESS_DB_NAME: wordpressn/

thanks for your time.

In your db:
MYSQL_DATABASE: wordpress

in wordpress:
WORDPRESS_DB_NAME: wordpressn/

these 2 should be the same

1 Like