Using MySql Remote database for ruby on rails application ?

Answer: If you want to use common database for a Ruby on Rails application running at more than one front end servers. You can do it by using grant command.

lets go step by step:

1.  Server on which you want to host the database for multiple / single instances

 $ mysql -u root -p

2. Granting permission of access to remote hosts:

  mysql > grant all on database_name.* to root@'ip_address' identified by ' ';

To grant access to multiple front end server repeat above command by changing the ip_address to the ip_address of the front end servers.

3. Now inside your database.yaml

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: database_name
  port: 3306
  pool: 5
  username: root
  password:
  host: ip_address_hosting_database
Advertisements

One thought on “Using MySql Remote database for ruby on rails application ?

Add yours

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

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: