How to use mysql database on ruby

I have fedora 8 and ruby on rails installed, but i need to use mysql database, not sqlite3. How i can change it to mysql? Can somebody help me?

You can run

rails -d mysql

to generate a rails app that uses mysql as its database. See

rails -h

for more options.

Or, you could change the config/database.yml file in your existing rails app to point at mysql if you know what to change. Here's how a basic one might look:

development:   adapter: mysql   database: blah_development   username: root   password:

test:   adapter: mysql   database: blah_test   username: root   password:

production:   adapter: mysql   database: blah_production   username: root   password:

Just change blah to your rails app name. And, you may want to make yours use more secure credentials instead of root and an empty password. :wink:

Regards, Craig

Thank you. It works now.

Just for future reference, you shouldn't use this list for help requests, this is a list for discussing the development of the framework. Usage questions should be sent to the general Rails mailing list, http://groups.google.com/group/rubyonrails-talk (or the Finnish list, http://groups.google.com/group/finnishrails, which has plenty of people able to help with your problems but not too many questions lately ;-).

//jarkko

Kiitos neuvosta, en tosiaan tajunnut että oon väärässä gruopissa, mut nyt siirsin sen toisen kysymyksen sinne talk grouppiin..

Have said that, here is a great resource for accessing databases through ruby: Ruby DBI: Database Access