Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
CircleCI:Mysql2::错误:Can';t连接到';127.0.0.1';(111)_Mysql_Ruby On Rails_Ruby_Rspec_Circleci - Fatal编程技术网

CircleCI:Mysql2::错误:Can';t连接到';127.0.0.1';(111)

CircleCI:Mysql2::错误:Can';t连接到';127.0.0.1';(111),mysql,ruby-on-rails,ruby,rspec,circleci,Mysql,Ruby On Rails,Ruby,Rspec,Circleci,我无法解决将circleCI 1.0更新为2.0时出现的错误。 我想用circleCI做的很简单,只是运行rspec测试 错误是 Mysql2::Error: Can't connect to MySQL server on '127.0.0.1' (111) 我的.circleci/config.yml文件是 version: 2 jobs: build: docker: - image: circleci/ruby:2.1-node-browsers

我无法解决将circleCI 1.0更新为2.0时出现的错误。 我想用circleCI做的很简单,只是运行rspec测试

错误是

Mysql2::Error: Can't connect to MySQL server on '127.0.0.1' (111)
我的.circleci/config.yml文件是

version: 2
jobs:
  build:
    docker:
      - image: circleci/ruby:2.1-node-browsers
        environment:
          RAILS_ENV: test
      - image: circleci/mysql:5.7
        environment:
          - MYSQL_USER=root
          - MYSQL_PASSWORD=''
    steps:
      - checkout

      # Restore bundle cache
      - restore_cache:
          key: rails-demo-{{ checksum "Gemfile.lock" }}

      # Bundle install dependencies
      - run: bundle install --path vendor/bundle

      # Store bundle cache
      - save_cache:
          key: rails-demo-{{ checksum "Gemfile.lock" }}
          paths:
            - vendor/bundle

      # Database setup
      - run: mv config/database.yml.sample config/database.yml
      - run: RAILS_ENV=test bundle exec rake db:create
      - run: RAILS_ENV=test bundle exec rake db:schema:load

      # Run rspec in parallel
      - type: shell
        command: |
          bundle exec rspec --profile 10 \
                            --format RspecJunitFormatter \
                            --out test_results/rspec.xml \
                            --format progress \
                            $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)

      # Save test results for timing analysis
      - store_test_results:
          path: test_results
default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

development:
  <<: *default
  database: app_development

test:
  <<: *default
  database: app_test
我的config/database.yml文件是

version: 2
jobs:
  build:
    docker:
      - image: circleci/ruby:2.1-node-browsers
        environment:
          RAILS_ENV: test
      - image: circleci/mysql:5.7
        environment:
          - MYSQL_USER=root
          - MYSQL_PASSWORD=''
    steps:
      - checkout

      # Restore bundle cache
      - restore_cache:
          key: rails-demo-{{ checksum "Gemfile.lock" }}

      # Bundle install dependencies
      - run: bundle install --path vendor/bundle

      # Store bundle cache
      - save_cache:
          key: rails-demo-{{ checksum "Gemfile.lock" }}
          paths:
            - vendor/bundle

      # Database setup
      - run: mv config/database.yml.sample config/database.yml
      - run: RAILS_ENV=test bundle exec rake db:create
      - run: RAILS_ENV=test bundle exec rake db:schema:load

      # Run rspec in parallel
      - type: shell
        command: |
          bundle exec rspec --profile 10 \
                            --format RspecJunitFormatter \
                            --out test_results/rspec.xml \
                            --format progress \
                            $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)

      # Save test results for timing analysis
      - store_test_results:
          path: test_results
default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

development:
  <<: *default
  database: app_development

test:
  <<: *default
  database: app_test
default:&default
适配器:mysql2
编码:utf8
游泳池:5
用户名:root
密码:
socket:/tmp/mysql.sock
发展:

你能分享你的git repo或circleci工作URL吗?