Using the circleci/mysql and circleci/postgres images simultaneously in the same job

Hi,

When I run both of these images at once, such as in my example project on Github, I get the following error when trying to connect to MySQL (example failure):

Access denied for user ‘user’@‘127.0.0.1’

However, if I remove the postgres image and run again with pipe again, everything works as intended (example of successful job).

Does anyone have any ideas how to get these two images to play together nicely?

Hi! Here is a link to the example project. I couldn’t post it in the initial post due to being limited to only posting two links:

example project on Github demonstrating this

Through corresponding with Fern over email support, I realized that my issue was that I was setting the environment variables all for the postgres image as in:

version: 2
jobs:
  build:
    docker:
      - image: circleci/golang:1.12
      - image: circleci/mysql:5.7
      - image: circleci/postgres:9.5-alpine-ram
        environment:
          MYSQL_ROOT_PASSWORD: rootpw
          MYSQL_DATABASE: test_db
          MYSQL_USER: user
          MYSQL_PASSWORD: passw0rd
          POSTGRES_USER: test
          POSTGRES_DB: spruce_test

when in fact, I needed to be doing:

version: 2
jobs:
  build:
    docker:
      - image: circleci/golang:1.12
      - image: circleci/mysql:5.7
        environment:
          MYSQL_ROOT_USER: root
          MYSQL_ROOT_PASSWORD: rootpw
          MYSQL_DATABASE: mysql
      - image: circleci/postgres:9.5-alpine-ram
        environment:
          POSTGRES_USER: test
          POSTGRES_DB: spruce_test
1 Like

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