Closed nickcoyne closed 2 months ago
Are you using the latest version? Also, we advocate that you run db:migrate
and let SecondBase run db:second_base:migrate
for you. This is so it can setup the ENV vars and all the patches to allow the second task to run correctly. Details here: https://github.com/customink/secondbase#database-tasks
Interested in hearing the results.
Unfortunately exactly the same result just running db:migrate
. I'm using the latest 2.1.6
.
Also I tried a fresh Rails 5.2 app and got the same result...
$ rails db:create
Created database 'test2nd_development'
Created database 'test2nd_test'
Created database 'test2nd_second_development'
Created database 'test2nd_second_test'
$ rails db:migrate
mysqldump: Got error: 1045: Access denied for user 'nick'@'localhost' (using password: NO) when trying to connect
rails aborted!
failed to execute: `mysqldump`
Please check the output above for any errors and make sure that `mysqldump` is installed in your PATH and has proper permissions.
/Users/nick/Projects/codevader/test2nd/bin/rails:9:in `<top (required)>'
/Users/nick/Projects/codevader/test2nd/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:structure:dump
Thanks, it sounds like we need to add Rails v5.2 to our Appraisals (https://github.com/customink/secondbase/blob/master/Appraisals) and do a few more freedom patches. I won't have time for a while so in the meantime, open to PRs if you feel up to it.
It seems to be an issue on Rails 5.1 too, I just tried with a fresh application.
With a Rails 5.2 app that uses
config.active_record.schema_format = :sql
, when I runrails db:second_base:migrate
I get amysqldump
error. It appears that it is not correctly parsing the user/password from my connection url.Inspecting the connection shows:
"{\"adapter\"=>\"mysql2\", \"encoding\"=>\"utf8\", \"reconnect\"=>false, \"pool\"=>1, \"url\"=>\"mysql2://root@localhost:3306/myapp_stats_development\", \"variables\"=>{\"sql_mode\"=>\"TRADITIONAL\"}}"
vs. this on the main database connection:
"{\"adapter\"=>\"mysql2\", \"encoding\"=>\"utf8mb4\", \"reconnect\"=>false, \"variables\"=>{\"sql_mode\"=>\"TRADITIONAL\"}, \"username\"=>\"root\", \"port\"=>3306, \"database\"=>\"myapp_development\", \"host\"=>\"localhost\"}"
I'm using the same format connection url for both databases.