How to get rails command to default to MySQL instead of SQLite?

I’m running OS/X 10.5 Leopard. Although I have MySQL installed the
rails command creates a database.yml file that defaults to SQLite. How
do I get it to default to MySQL instead?

TIA

Hmmm.

The Rails default is actually mysql. I haven’t looked at what they
changed
in 10.5 as I am still running my own build of Ruby and Rails.

You can force the db type though.

rails my_new_app --database=mysql

Hmm, sure enough:

#the pre-installed rails:
macbookpro: wpratt$ /usr/bin/rails
… snip …
-d, --database=name Preconfigure for selected database
(options: mysql/oracle/postgresql/sqlite2/sqlite3).
Default: sqlite3

#and from my own stack:

macbookpro: wpratt$ /usr/local/bin/rails
… snip …
-d, --database=name Preconfigure for selected database
(options: mysql/oracle/postgresql/sqlite2/sqlite3).
Default: mysql

I guess this makes sense since Leopard doesn’t ship with mysql but
does ship with sqlite3.

-Bill

On Nov 5, 5:06 am, “[email protected][email protected] wrote:

I’m running OS/X 10.5 Leopard. Although I have MySQL installed the
rails command creates a database.yml file that defaults to SQLite. How
do I get it to default to MySQL instead?

TIA

The quick&dirty way is to edit

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/
gems/1.8/gems/rails-1.2.3/lib/rails_generator/generators/applications/
app/app_generator.rb

on lines 9 and 104 (replace sqlite3 with mysql)

Or you could install rails version 1.2.5; which defaults again to
mysql.
Rails 1.2.5 is then installed in /Library/Ruby/Gems/1.8/gems/
rails-1.2.5/

Personally I like sqlite3 as the default and would like to know how to
tell gem to use this as the default. Setting the shell variable
RAILS_DEFAULT_DATABASE doesn’t seem to work.