mmcgrana-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-12 03:49 UTC
Connecting to Production Database
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
andrew.ohnstad-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Jun-12 15:51 UTC
Re: Connecting to Production Database
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 On Jun 11, 11:49 pm, "mmcgr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <mmcgr...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---