Hey for the fist steep make sure you have the eight gem and install support for Mysql:
Configuring Rails Applications
In this section, we will modify the Rails application servers so that they start working with the database server we have just set up.
Installing Database Server Libraries
The first thing to do is installing the necessary database libraries. In our case, it is MySQL's development package.
Run the following to install MySQL development package mysql-devel:
yum install -y mysql-devel
Configuring database.yml For Rails
Database settings for Rails applications are kept inside the database.yml file in /config directory.
Run the following command to edit the database.yml file using the nano text editor:
# Make sure to enter your application deployment directory
# Example:
# cd /var/www/my_app
nano config/database.yml
Once you open up this file, you will see database settings, divided by environment names. Since an application needs to run using the production environment, let's edit the configuration for that.
Replace the production: YML code block with the following, changing the necessary bits to suit your own set-up configuration, e.g. the IP address etc.
# Example:
# production:
# adapter: mysql
# encoding: utf8
# database: [database name]
# username: [user name]
# password: [password]
# host: [server IP address]
# port: [port number]
# protocol: [protocol]
# pool: [connection pool]
production:
adapter: mysql
encoding: utf8
database: rails_myapp
username: rails_myapp_user
password: pwd
host: 128.199.233.36
port: 3306
pool: 10
Note: As provided in the example above, you might need to specify the
protocol.
Note: The pool argument contains the number of maximum simultaneous
database connection slots (i.e. pool) available. You need to assess
your needs and set a number accordingly.
Save and exit by pressing CTRL+X and confirming with Y.
Getting The mysql Gem
Start editing the Gemfile using nano using the following:
nano Gemfile
Add the following line to the file:
gem 'mysql'
Save and exit by pressing CTRL+X and confirming with Y.
Install the new gem using bundle:
bundle install
And that's it! From now on, your Rails application servers will be using your brand new database server for all operations.
you can find more info in:
https://www.digitalocean.com/community/tutorials/scaling-ruby-on-rails-setting-up-a-dedicated-mysql-server-part-2