Correct MySQL configuration for Ruby on Rails Database.yml file

GeekedOut picture GeekedOut · May 3, 2011 · Viewed 119.3k times · Source

I have this configuration:

development:
  adapter: mysql2
  encoding: utf8
  database: my_db_name
  username: root
  password: my_password
  host: mysql://127.0.0.1:3306

And I am getting this error:

Unknown MySQL server host 'mysql://127.0.0.1:3306' (1)

Is there something obvious that I am doing incorrectly?

Answer

Amokrane Chentir picture Amokrane Chentir · May 3, 2011

You should separate the host from the port number. You could have something, like:

development:
  adapter: mysql2
  encoding: utf8
  database: my_db_name
  username: root
  password: my_password
  host: 127.0.0.1
  port: 3306