Add a new database for MySQL container on a different port

I am attempting to add a new database to a mysql container for a circleci test run. I already have a mysql container running on 3306.

Is there an easy way to either:

  • create a new database within the existing container that I can then reference in circleci (I’ve gone down this path for awhile and there doesn’t seem to be an easy way to do this)
  • create a new container and expose a non-default port of my choosing

Circlci yaml doesn’t appear to let you specify ports like standard docker-compose yaml, nor do I see an alternative way to do this and I’m looking for some inspiration. I did try to build my own MySQL container with a different exposed port but that attempt was unfruitful, and I would rather use the same container if possible.

Thanks in advance for any advice!

I would assume it is possible. I take it that MySQL is a secondary container in your set-up, rather than spinning up MySQL in your primary container?

One thing I would dig into is this document - see that PostgreSQL takes an env var of POSTGRES_USER. Maybe there would be something similar for the MySQL host?