firstruby

Master ruby with us

Access Remote MySQL database in RubyonRails application

Posted by firstruby on October 23, 2008

To give the remote access to database, on server, we have to give the following command,

mysql> CREATE DATABASE foo_development;
mysql> GRANT ALL ON
foo_development.* TO root@'192.168.1.25' IDENTIFIED BY 'PASSWORD';

where 192.168.1.25 – IP Address of the client machine,

Now modify  ../config/database.yml file in our RoR application as follows,

development:
adapter: mysql
database: foo_development
username: root
password: PASSWORD
host: 192.168.1.1

where 192.168.1.1 – IP Address of server

Advertisements

One Response to “Access Remote MySQL database in RubyonRails application”

  1. akhil said

    nice catch 😉

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: