Note: this is similar to Use Ruby on Rails and SSH to access remote MySQL database on remote server, but the OP didn't provide much info, and the only answer given doesn't answer the question.
background
We recently switched our remote database from password authentication to ssh key based authentication. I have verified that I can access the db through the elegant Sequel Pro graphical db client with the following settings (some names intentionally obfuscated):
MySQL Host: woofwoof.us-west-2.rds.amazonaws.com
Username: bowser
Database: canine
Port: 3306
SSH Host: salt.woofwoof.com
SSH User: guardian
SSH Key: ~/.ssh/id_rsa
Now I need Rails to connect to the same database, also using ssh key-based authentication.
the question
What goes in my config/database.yml
file?
So far I have:
canine:
adapter: mysql2
database: canine
username: bowser
host: woofwoof.us-west-2.rds.amazonaws.com
port: 3306
... but how do I specify SSH Host
, SSH User
and SSH Key
in the config/database.yml
file?
additional info
Back when our database had password authentication, the following worked:
canine:
adapter: mysql2
database: canine
username: bowser
password: *secret*
host: woofwoof.us-west-2.rds.amazonaws.com
port: 3306