CircleCI 2.0 with more than 1 database in a Rails app


I have an app that requires 2 databases. The first one gets created without issue, via db:create and db:schema:load

The second database is not being created. The rake task is run, but the code for the rake task is:
system(mysql -uubuntu -e "create database test")

It appears it is trying to run this on the base local image, which is not what I want. I tried adding -h to the command, but then it claims it cannot connect to the host.

Config file looks like this:

version: 2
      - image: tenshotanaka/ruby-and-node
          - RAILS_ENV=test
      - image: circleci/mysql:5.7.18
          - MYSQL_USER=ubuntu
          - MYSQL_ROOT_HOST=%

      - checkout

      - run:
          name: install node dependencies
          command: npm install

      - run:
          name: install Ruby dependencies
          command: |
            gem install bundler
            bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3

      - run:
          name: setup Finder database
          command: bundle exec rake db:create db:schema:load --trace

      - run:
          name: Run node tests
          command: npm test

      - run:
          name: Run Rake tests
          command: rake test
            DATABASE_URL: mysql2://


Try removing those env vars and using the root user. We already define them:


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