Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rake db:create fails on docker setup #229

Open
MatheusRich opened this issue Mar 8, 2019 · 3 comments
Open

rake db:create fails on docker setup #229

MatheusRich opened this issue Mar 8, 2019 · 3 comments

Comments

@MatheusRich
Copy link
Contributor

Hi! I was trying to setup my development environment with docker. I've followed the tutorial on README.md, but i fails after running docker-compose run amahi_web bundle exec rake db:create.

Here's the output:

Starting platform_amahi_box_1_dfd960b06721 ... done
Starting amahi_mysqldb                     ... done
Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "database"=>"amahi_dev", "host"=>"amahi_mysqldb", "username"=>"root", "password"=>"test123"}
rake aborted!
Mysql2::Error: Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
/box/gems/mysql2-0.5.1/lib/mysql2/client.rb:90:in `connect'
/box/gems/mysql2-0.5.1/lib/mysql2/client.rb:90:in `initialize'
/box/gems/activerecord-5.2.0/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `new'
/box/gems/activerecord-5.2.0/lib/active_record/connection_adapters/mysql2_adapter.rb:22:in `mysql2_connection'
/box/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:809:in `new_connection'
/box/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:853:in `checkout_new_connection'
/box/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:832:in `try_to_checkout_new_connection'
/box/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:793:in `acquire_connection'
/box/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:521:in `checkout'
/box/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:380:in `connection'
/box/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:1008:in `retrieve_connection'
/box/gems/activerecord-5.2.0/lib/active_record/connection_handling.rb:118:in `retrieve_connection'
/box/gems/activerecord-5.2.0/lib/active_record/connection_handling.rb:90:in `connection'
/box/gems/activerecord-5.2.0/lib/active_record/tasks/mysql_database_tasks.rb:6:in `connection'
/box/gems/activerecord-5.2.0/lib/active_record/tasks/mysql_database_tasks.rb:14:in `create'
/box/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:119:in `create'
/box/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:139:in `block in create_current'
/box/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:316:in `block in each_current_configuration'
/box/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:313:in `each'
/box/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:313:in `each_current_configuration'
/box/gems/activerecord-5.2.0/lib/active_record/tasks/database_tasks.rb:138:in `create_current'
/box/gems/activerecord-5.2.0/lib/active_record/railties/databases.rake:29:in `block (2 levels) in <top (required)>'
/box/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `load'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:27:in `run'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:335:in `exec'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:20:in `dispatch'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/cli.rb:11:in `start'
/usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>'
/usr/local/share/gems/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/usr/local/share/gems/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>'
/usr/local/bin/bundle:22:in `load'
/usr/local/bin/bundle:22:in `<main>'
Tasks: TOP => db:create
(See full trace by running task with --trace)

Am I missing something? Let me know!

@visheshruparelia
Copy link

This is because in mysql 8 they set caching_sha2_password as the default authentication plugin, while every version before supported mysql_native_password plugin. Thus you need to access the bash of amahi_mysqldb container and update the default identification method of the user root.

To access amahi_mysql db image's bash:

docker exec -it amahi_mysqldb bash

To change the default authentication method:

ALTER USER root
IDENTIFIED WITH mysql_native_password
BY 'test123';

Hope this helps.

@alaxalves
Copy link

@visheshruparelia Wouldn't be nicer to lock MySQL version instead?

@visheshruparelia
Copy link

@alaxalves Yes, it would. It was only a workaround which I used to get it working. To lock the version, it would need to be discussed first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants