Reputation: 3341
I am trying to set up a Travis configuration for my RoR app, but I cannot get passed from the the access point for the MySQL database. here is my .travis
contents:
language: ruby
rvm:
- 2.4.0
cache: bundler
sudo: required
env:
- RAILS_ENV=test
matrix:
fast_finish: true
services:
- mysql
addons:
apt:
packages:
- imagemagick libmagickwand-dev
before_install:
- bash .travis.install-mysql-5.7
- gem update --system 2.6.11
- gem update bundler
before_script:
- cp .travis.database.yml config/database.yml
script:
- RAILS_ENV=test bundle exec rake db:create
- RAILS_ENV=test bundle exec rake db:migrate
And in my .travis.database.yml
I've have done everything by the book:
default: &default
adapter: mysql2
encoding: utf8
username: root
development:
<<: *default
database: site_development
test:
<<: *default
database: site_test
production:
<<: *default
database: site_production
username: site
password: <%= ENV['SITE_DATABASE_PASSWORD'] %>
Here is the Travis' output:
$ cp .travis.database.yml config/database.yml
$ RAILS_ENV=test bundle exec rake db:create
#<Mysql2::Error: Access denied for user 'root'@'localhost'>
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "username"=>"root", "database"=>"site_test"}, {:charset=>"utf8"}
(If you set the charset manually, make sure you have a matching collation)
Created database 'site_test'
The command "RAILS_ENV=test bundle exec rake db:create" exited with 0.
$ RAILS_ENV=test bundle exec rake db:migrate
rake aborted!
Mysql2::Error: Access denied for user 'root'@'localhost'
Upvotes: 0
Views: 615
Reputation: 3341
For what it worth, I forgot to reset the newly installed MySQL 5.7's username & password, noticed from here.
Upvotes: 1
Reputation: 338
What's root's password for mysql?
Add that to
test:
<<: *default
database: site_test
password: ROOT_PASSWORD_GOES_HERE
Upvotes: 0