Ruby on Rails on MacBook


#1

Hi,

I’m trying to set up Ruby on Rails following Apple’s tutorial with ruby
1.8.4 and mysql 5.0.22. But every time I ran ‘rake migrate’ I got the
following access denied error:

Access denied for user ‘root’@‘localhost’ (using password: YES)

After turning on --trace switch, it showed the error happened at the
following line:

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:331:in
`real_connect’

I don’t whether it’s a rails problem or mysql problem. But I thought I
would give it a shot by posting the question here.

Thanks in advance.

Regards,

Simon


#2

It’s a MySQL problem. You’ve got to ‘grant access’ for the user in
mysql or do one of the options here;

http://dev.mysql.com/doc/refman/5.0/en/access-denied.html

Best,
russ


#3

Thanks Russ.

It doesn’t look like an access problem though because I can access with
the same user and password using mysql command line tool. Also, ‘rake
migrate’ worked after I set the password to be empty. Could it be the
way rails sends password to mysql?


#4

Simon L. wrote:


#5

Ray B. wrote:

Simon L. wrote:

It doesn’t look like an access problem though because I can access with
the same user and password using mysql command line tool. Also, ‘rake
migrate’ worked after I set the password to be empty. Could it be the
way rails sends password to mysql?

This sounds like an incomparability between mysql 4.0 and earlier and
4.1 and later. There was a change to the password hashing algorithm.
Version 4.0 and earlier use 16 characters, 4.1 and later 40 characters.

The standard ruby installation uses a mysql adapter that is compatible
with 4.0 and below. You need to update your mysql adapter.

http://www.tmtm.org/en/mysql/ruby/

If you aren’t comfortable at the command line, there are some other
instructions which Google will point you to.

Ray

Thanks. It still doesn’t work. It must be a ruby adapter’s problem
because I can connect through JDBC with no problem. I’m gonna give up
on this one. The MacBook is after all just my development box. It
seems to be working fine on the server, a Ubuntu desktop. I guess I can
live with using a user without password on the MacBook.


#6

Simon L. wrote:

It doesn’t look like an access problem though because I can access with
the same user and password using mysql command line tool. Also, ‘rake
migrate’ worked after I set the password to be empty. Could it be the
way rails sends password to mysql?

This sounds like an incomparability between mysql 4.0 and earlier and
4.1 and later. There was a change to the password hashing algorithm.
Version 4.0 and earlier use 16 characters, 4.1 and later 40 characters.

The standard ruby installation uses a mysql adapter that is compatible
with 4.0 and below. You need to update your mysql adapter.

http://www.tmtm.org/en/mysql/ruby/

If you aren’t comfortable at the command line, there are some other
instructions which Google will point you to.

Ray


#7

Have you tried using Locomotive? I used that to set up my new macbook
and it
was a breeze.

Steve


#8

Is the Ubuntu box running mysql5 also?

On 6/3/06, Simon L. removed_email_address@domain.invalid wrote:

Version 4.0 and earlier use 16 characters, 4.1 and later 40 characters.


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails


#9

Thanks for all the suggestions guys. Like I said, I might just stick to
the user without password solution. :slight_smile: I’m sure someday there will be
a version of the adapter that will ‘just work’.

Julian ‘Julik’ Tarkhanov wrote:

On 4-jun-2006, at 2:46, Steve O. wrote:

Have you tried using Locomotive? I used that to set up my new
macbook and it was a breeze.

It’s obviosly the “old passwords” problem in MySQL. Please google.


Julian ‘Julik’ Tarkhanov
please send all personal mail to
me at julik.nl


#10

Try this:

sudo gem install mysql – --with-mysql-config

Cheers,

-DF


#11

On 4-jun-2006, at 2:46, Steve O. wrote:

Have you tried using Locomotive? I used that to set up my new
macbook and it was a breeze.

It’s obviosly the “old passwords” problem in MySQL. Please google.


Julian ‘Julik’ Tarkhanov
please send all personal mail to
me at julik.nl