Yourls password connection error: can't connect to MySQL

I am trying to get the following working: yourls - Official Image | Docker Hub.

For testing purposes simply used the compose file as stated.

version: '3.1'

services:

  yourls:
    image: yourls
    restart: always
    ports:
      - 8080:80
    environment:
      YOURLS_DB_PASS: example
      YOURLS_SITE: https://192.168.10.175
      YOURLS_USER: example_username
      YOURLS_PASS: example_password

  mysql:
    image: mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_DATABASE: yourls

The two containers come up and appear to be running fine but when I browse to http://192.168.10.175:8080/admin, I get

I am assuming that the 2nd part of the docker compose file creates the MySQL database, setting the root password to “example” but I might be wrong.

Yes, MYSQL_ROOT_PASSWORD sets the password but only when the contain starts the first time. If you change it later, you have to do it manually. It also takes time and the yourls service could strt before the database is initialzed, but I assume you tried multiple times after waiting a couple of minutes.

Yes I did but I did not wait too long the first time so maybe that broke things. Going to remove everything and try again.