Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Correct MySQL configuration for Ruby on Rails Database.yml file

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?

like image 967
GeekedOut Avatar asked May 03 '11 15:05

GeekedOut


People also ask

Where is config database yml?

The main databases. yml configuration file for a project can be found in the config/ directory. Most of the time, all applications of a project share the same database. That's why the main database configuration file is in the project config/ directory.

What database is used with Ruby on Rails?

Rails comes with built-in support for SQLite, which is a lightweight serverless database application. While a busy production environment may overload SQLite, it works well for development and testing. Rails defaults to using a SQLite database when creating a new project, but you can always change it later.


1 Answers

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 
like image 120
Amokrane Chentir Avatar answered Sep 19 '22 13:09

Amokrane Chentir