Forum: Ruby on Rails Connecting to Production Database

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3423442e7b51da238e663b343169b756?d=identicon&s=25 mmcgrana@gmail.com (Guest)
on 2007-06-12 05:50
(Received via mailing list)
I would like to connect to my production database from my local
machine, so that I can import/export data using rake commands. (for
example: RAILS_ENV=production rake db:fixtures:load)

My database.yml file is typical:

development:
  adapter: mysql
  database: my_app_development
  username: root
  password:
  host: localhost

test: ...

production:
  adapter: mysql
  database: my_app_production
  username: root
  password:
  host: localhost

The production database works for the rails app itself, presumably
because the app and the db run on the same machine, and hence the
'localhost' to the app is indeed the db server, but I cannot access
the db from local rake tasks.  I've tried setting the production host
to the ip of the server, but that didn't work either.

Any thoughts on how to establish this remote production db connection
would be greatly appreciated.
744b6438d1457d332d1a8d431cc2b641?d=identicon&s=25 andrew.ohnstad@gmail.com (Guest)
on 2007-06-12 17:53
(Received via mailing list)
Your discription is not 100% clear, but I am assuming your application
and MySQL server is on the Internet somewhere, you have a copy of your
application on your local PC, and you want to be able to run commands
like rake on your local PC and have them execute on the remote server.

If this is the case I would suggest you look into a tool like
Capistrano because it will do these things much more safely and
securely.  If you're intent on doing it by hand then you need to look
into the MySQL command 'GRANT' in order to give permission for your
local PC to execute SQL statements on the server.  Note that if you
have a DCHP address from your ISP that changes on any kind of regular
basis you will either have to change the permissions on the SQL server
whenever  your IP changes, or make the permissions vague enough to
allow undesirables to access your DB.  This is one of the key reasons
Capistrano is so awesome.

Short answer: google 'MySQL GRANT' and/or 'capistrano'.

---A
This topic is locked and can not be replied to.