Application rails with remote database

0

I'm starting in ruby on rails and I want to make an application connected to mysql , but the database is on a remote server. I have to create the database beforehand or I do it later from the console with rake db: create?

Here's my database.yml:

default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  username: root
  password: xxxx
  host: 192.168.1.xx

and this is the error I get:

  

Access denied for user 'root' @ '%' to database 'app_name_development'

Does anyone have any idea how to perform this task?

    
asked by daniel2017- 19.01.2017 в 12:59
source

1 answer

0

You only need to have the connection to the remote server available and configure this connection in the database.yml.

  

Note: The database on your server must be configured to   accept remote connections.

  production: 
  adapter: postgresql
  encoding: utf-8
  pool: 5
  username: "username"
  password: "password"
  host: "hostname"
  port: "port number"
  database: "database name"

The rest is still the same, creation, migrations and data loading you can continue doing them in the standard way.

To configure Mysql and accept remote connections in the file

vim /etc/mysql/my.cnf

comment on the line

#bind-address           = 127.0.0.1
    
answered by 19.01.2017 в 15:30