Check out example codes for "rails connect to remote database". It will help you in understanding the concepts better.

Code Example 1

[rails_env]:
  adapter: mysql2
  encoding: utf8
  pool: 5
  host: [mysql_ip]
  username: [mysql_username]
  password: [mysql_password]
  port: [mysql_port]
  socket: [path_to_mysql_socket_file]
  database: [db_name]

Learn ReactJs, React Native from akashmittal.com