Reputation: 46419
I'm wondering how to pass MySQL client config to the "rails db" command, ie config options that would normally be specified on the "mysql" command line as flags or in my.cnf.
Specifically:
sigint-ignore
(because accidental ctrl-c exits are all too easy)Upvotes: 1
Views: 603
Reputation: 13067
rails db
- alias to rails dbconsole
- uses the config in config/database.yml
and opens the appropriate command line interface.
For connecting to mysql
databases, mysql2 is specified as the adapter in config/database.yml
with adapter: mysql2
.
mysql2 adapter
provides for reading from a custom mysql configuration file with the :default_file
and :default_group
parameters; see https://github.com/brianmario/mysql2#reading-a-mysql-config-file
sigint-ignore
can be specified as follows:In config/database.yml
:
development:
adapter: mysql2
database: example_dev
pool: 5
username: root
password:
default_file: /Users/mahemoff/.my.cnf
default_group: client
In /Users/mahemoff/.my.cnf
:
[client]
sigint-ignore
"rails db" doesn't seem to look at database.yml)
rails db
does use the password set in database.yml
.
Upvotes: 1