Setting up rails environment on Leopard

Hi there!

I was just setting up my rails environment in Leopard, with help of the Sitepoint ROR book. However, I've a problem with the MySQL installation. The installation of MySQL itself went okay, and I did a fix to actually start MySQL on Leopard (because this was also a problem). Now, running MySQL, I get in my Rails application welcome screen that the database adapter is sqlite?

Ruby version 1.8.6 (universal-darwin9.0) RubyGems version 0.9.4 Rails version 1.2.3 Active Record version 1.15.3 Action Pack version 1.13.3 Action Web Service version 1.2.3 Action Mailer version 1.3.3 Active Support version 1.4.2 Application root /Users/shovell Environment development Database adapter sqlite3

Am I missing a installation step?

Thanks!

rails on leopard defaults to sqlite (reasonably enough - leopard ships with sqlite but not mysql). You need to edit your database.yml or pass --database=mysql to the rails command when you generate the app.

Fred

Or you can update to rails 1.2.5. This version defaults to mysql.

Thanks all, got it working now.

Thanks all, got it working now.

Hmm, seems not to work actually. When I now want to create databases, as the book suggest, the system can't find the command:

$ mysql5 -u root

should be mysql -u root, not mysql5

jy_nl wrote:

Working on Mac OS X so the book says mysql5 (but also mysql doesn't work)

try this.

$ mysql -u root use mysql;

UPDATE user SET Password=PASSWORD("secret"); flush privileges;

$ mysql -u root -p

create database foo_dev;

grant all on foo_dev.* to 'foo'@'%' identified by 'foo'; flush privileges;

$ mysql -u foo -p

/Frank

I use osx as well. Maybe they have started creating a symlink called mysql5, but not to my knowledge. I assume the problem is that mysql is not in your path. You probably need to fully qualify the path to it. I am not sure where or how you installed it so I can’t help you with the path, but try “locate mysql” and that will get you pointed in the right direction.

-Bill

jy_nl wrote:

That won’t work, mysql is not in his path.

-Bill

Frank Vilhelmsen wrote:

@Frank: $ mysql -u root doesn't work, so I'm not coming any further :frowning:

@William: when I just installed as usually, where is my MySQL path.

Found something out: when I use the MySQL GUI I can create databases and do things with it. So it is probably what William is saying.

William where can I find the path of MySQL when I installed just the normal version without changing the path? I found out that I can create databases using the MySQL GUI.

Open a terminal and type “locate mysql_upgrade”. The path to the mysql binary will be the same, so for example if that command returns /usr/local/mysql/bin/mysql_upgrade, then mysql is in /usr/local/mysql/bin/mysql. You can just type “locate mysql”, but you will get a ton of results so using the first command will be much cleaner.

If you just installed mysql today, the locate database may not have updated yet. In that case, type “/usr/libexec/locate.updatedb”. Once that finishes, run the locate command again from above.

Let me know if you need more help.

-Bill

jy_nl wrote:

my .profile file ,

export PATH=$PATH:/usr/local/bin:/usr/local/mysql/bin:$JRUBY_HOME/bin

I think that this is the default path to mysql.

Ahh, there you go, thats probably it. I compiled mine from source, so I wasn’t sure.

-Bill

Frank Vilhelmsen wrote:

Hmm, weird he can't find mysql_upgrade, even if I update the locate database. Also tried the the folder /usr/local/mysql/bin, but there he cannot find another folder mysql and the query doesn't work.

If you can find /usr/local/mysql then the command to run should be:

/usr/loca/mysql/bin/mysql -u root

-Bill

jy_nl wrote:

Yes, it is working now! Thanks for your help.