Multiple MySQL DBs

mysql
2.0

#1

With this top level config with two MySQL dbs, the second db always does an exit code 1 after it starts up. Is there a way to prevent this?

version: 2

jobs:
  build:
    docker:
      - image: node:7.9-alpine # primary container
      - image: library/mysql:5.6
        environment:
          MYSQL_ROOT_PASSWORD: test
          MYSQL_DATABASE: test
        ports:
          - 3306:3306
      - image: library/mysql:5.6
        environment:
          MYSQL_ROOT_PASSWORD: test2
          MYSQL_DATABASE: test2
        ports:
          - 3307:3306

#2

You can’t redefine ports like that so you’d need to rebuild a MySQL image with a different EXPOSE defined in the Dockerfile.


#3

That would be an awesome feature though.


#5

I got it to work, but you also have to add port configuration in /etc/mysql/my.cnf or /etc/mysql/mysql.conf.d/mysqld.cnf under the [mysqld] header in the image.

So if anyone needs a mysql 5.6 exposed with port 3307, here’s my image.
https://hub.docker.com/r/ethanheadspace/mysql/


#6

Kudos! Thanks for sharing that; that’s awesome :slight_smile:


#7

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.