2

I have been working with Rails since two months but until now I haven't use databases.

I would like that my web-app connects to a remote database (MySQL) and extract some data to plot it in Rails using Highcharts.

I have found many tutorials that explains how to connect to an existing database (editing config/database.yml) but this is in the same server.

I am using Ubuntu 14.04 LTS.

Could anyone explains me which are the steps or how can achieve this connection to the remote database with Rails and how to extract the data from a given database?

0

2 Answers 2

6

You just edit the database.yml file so that it points to the remote database:

  adapter: mysql2
  encoding: utf-8
  pool: 5
  username: "username"
  password: "password"
  host: "hostname"
  port: "port number"
  database: "database name"
Sign up to request clarification or add additional context in comments.

2 Comments

But for that should I install the gem 'mysql2' in my computer?
yeah add it to your gemfile gem 'mysql2'
-2

After two days asking in forums and people, nobody could help me, however, I found a solution.

  1. IMPORTANT: To connect to an external database you should first create the SSH tunnel!!!!

  2. Configure the database.yml

1 Comment

any advice or links on how to do that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.