mysql - How do I configure Rails for password-less access to remote database -
note: similar use ruby on rails , ssh access remote mysql database on remote server, op didn't provide much info, , reply given doesn't reply question.
backgroundwe switched our remote database password authentication ssh key based authentication. have verified can access db through elegant sequel pro graphical db client next 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 need rails connect same database, using ssh key-based authentication.
the questionwhat goes in config/database.yml
file?
so far have:
canine: adapter: mysql2 database: canine username: bowser host: woofwoof.us-west-2.rds.amazonaws.com port: 3306
... how specify ssh host
, ssh user
, ssh key
in config/database.yml
file?
back when our database had password authentication, next worked:
canine: adapter: mysql2 database: canine username: bowser password: *secret* host: woofwoof.us-west-2.rds.amazonaws.com port: 3306
first, need found ssh tunnel mysql server. on client machine, run:
ssh -fng -l 3307:127.0.0.1:3306 guardian@salt.woofwoof.com
that found ssh tunnel salt.woofwoof.com server. connections localhost port 3307 sent through tunnel remote host on port 3306.
then configure database.yml local connection, specify forwarded port 3307:
canine: adapater: mysql2 database: canine username: bowser password: *secret* port: 3307
you may want add together ssh tunnel setup /etc/inittab tunnel found after boot. see http://chxo.com/be2/20040511_5667.html 1 illustration of how that.
mysql ruby-on-rails ruby ssh
No comments:
Post a Comment