skip to Main Content

I have a server that already run a MySQL server container on port 3306:3306 (build from a docker-compose.yml file)

I would like to run another MySQL container on port 3307:3306 from another docker-compose.yml. The problem is that for the second container the MYSQL_ROOT_PASSWORD is never set and I got an access denied.

Both containers are targeting different volumes.

Is it possible to run two MySQL container from two different docker-compose.yml file on the same server?

2

Answers


  1. Chosen as BEST ANSWER

    The problem is solved.

    docker-compose.yml doesn't accept env variable with the char $. To solve it we must escape the char like this : $$.

    Thanks for your help guys.


  2. You are able to run 2 instances of MySQL on the same host and they don’t interfere with each other.

    What I think is causing your issue is that the environment variable MYSQL_ROOT_PASSWORD (and other environment variables) is only used when the container is started witout an existing database. If a database already exists, then the root password stored in the database is used.

    You need to find out what root password was set when the database was created and use that.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search