CircleCI:Mysql2::错误:Can';t连接到';127.0.0.1';(111)
我无法解决将circleCI 1.0更新为2.0时出现的错误。 我想用circleCI做的很简单,只是运行rspec测试 错误是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
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吗?