MySQL Forums
Forum List  »  Ruby

Re: Trouble with initial mysql configuration
Posted by: Frank Mash
Date: March 23, 2006 02:37PM

Rajesh Kanna wrote:
> Hai ,
>
> Kindly tell me how to connect Ruby with mysql
>
> Rajesh

I will assume that you would like to connect to MySQL using your Rails application.

So after you have created the application using ($ represents command prompt)
$ rails myapp

you can edit the config/database.yml and modify it according to your preferences.

A sample configuration file for your database can look like (replace adoppt_com with your database name):
# --------------------
login: &login
adapter: mysql
host: 127.0.0.1
username: user
password: pass
port: 3306
socket: /var/lib/mysql/mysql.sock

development:
database: adoppt_com
<<: *login

test:
database: adoppt_com
<<: *login

production:
database: adoppt_com
<<: *login

# -----------

In addition, you may need to run the following (first time) to get the appropriate bindings

$ gem install mysql


Hope this helps

--Frank

Options: ReplyQuote


Subject
Written By
Posted
Re: Trouble with initial mysql configuration
March 23, 2006 02:37PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.