Forum: Ruby on Rails can't get rails to connect to mySQL - HELP!!!!!!!!!

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
john (Guest)
on 2006-03-02 20:35
Sorry, but this is really NOT as easy as the tutorials/books make out.
I'm really struggling at the first hurdle here. And while I'm not a
programmer by design I do know my way around most stuff. And if I can't
get this to work I suspect more people will have the same issues. There
seems to be too many variables to address.
I have winXP, I have ruby and rails all working OK and have done the
first "hello world" stuff. Now when I try to connnect to mySQL I get
"#28000Access denied for user 'root'@'localhost' (using password: NO)".
I've tried everything, resetting, new password, restarting server,
mySQL, re-install of mySQL. All to know avail.
Having bought the book and gone to all this trouble to get something
working I'm struggling to see what the point is. I could have connected
to a database and done this with php pretty quickly compared to the two
unbillable days so far.
Please convert me back to wanting to use rails...someone!
Andrew VanSpronsen (Guest)
on 2006-03-02 20:52
(Received via mailing list)
Hello,

Did you configure your database.yml file with the appropriate
credentials
for your MySQL server?

Andrew

On 3/2/06, john <removed_email_address@domain.invalid> wrote:
> mySQL, re-install of mySQL. All to know avail.
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>



--
Kevin E. (Guest)
on 2006-03-02 20:59
john wrote:
> "#28000Access denied for user 'root'@'localhost' (using password: NO)".

I recall having issues connect to mySql with 'root'...I didn't bother to
chase the problem any further, I've found the following works well:

On the mysql console, create your database, then do:

> use <database>
> grant all on <database>.* TO 'foo'@'localhost' using 'foopass';

Then update your database.yml so it is configured to access your
<database> using foo and foopass as the user and password.

You should probably restart your server (apache, lightttpd, or
whichever) after you do these changtes to ensure it picks them up.
Derrick S. (Guest)
on 2006-03-02 21:06
(Received via mailing list)
On 3/2/06, john < removed_email_address@domain.invalid> wrote:
Sorry, but this is really NOT as easy as the tutorials/books make out.
I'm really struggling at the first hurdle here. And while I'm not a
programmer by design I do know my way around most stuff. And if I can't
get this to work I suspect more people will have the same issues. There
seems to be too many variables to address.
I have winXP, I have ruby and rails all working OK and have done the
first "hello world" stuff. Now when I try to connnect to mySQL I get
"#28000Access denied for user 'root'@'localhost' (using password: NO)".
I've tried everything, resetting, new password, restarting server,
mySQL, re-install of mySQL. All to know avail.
Having bought the book and gone to all this trouble to get something
working I'm struggling to see what the point is. I could have connected
to a database and done this with php pretty quickly compared to the two
unbillable days so far.
Please convert me back to wanting to use rails...someone!


You have to setup your database.yml file with the proper username and
password to your database (just like they told you to do in the
tutorials ;) ).  This is of course assuming that you have actually
set up MySQL correctly.

Hm, winXP... that may be the problem right there.  *sigh* ;)

-Derrick S.
john (Guest)
on 2006-03-02 21:58
thanks for the prompt replies.
Sadly, still no joy.

Tried the grant all but this did not help either.

I have set up the yml file as per the tutorials. Sadly, I have gone
through the tutorial from agile web development line by line and still
not been able to achieve the "agility" promised.

my yml file has this:
 adapter: mysql
  database: depot_test
  username:
  password:foo
  socket: /path/to/your/mysql.sock

I can log into mySQL from the command line so I figure that is set up
OK.
Is win XP the issue. I have a mac - I could upgrade to Tiger and work on
that if that is a better environment.

I would really like to make this work so I'm willing to try any
suggestions.
Andrew VanSpronsen (Guest)
on 2006-03-02 22:06
(Received via mailing list)
My config file looks like this:

  adapter: mysql
  database: eventweb
  host: localhost
  username: root
  password: mypassword
  socket: /path/to/your/mysql.sock

Andrew

On 3/2/06, john <removed_email_address@domain.invalid> wrote:
> my yml file has this:
>
> I would really like to make this work so I'm willing to try any
> suggestions.
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>



--
Derrick S. (Guest)
on 2006-03-02 23:35
(Received via mailing list)
>  adapter: mysql
>
> I would really like to make this work so I'm willing to try any
> suggestions.

My winXP comment was mostly tongue in cheek.  I like to take shots at
windows guys whenever possible.  When asked, I always tell people
that in the late 90's there was a legitimate argument for whether
windows was better than macintosh.  However, starting with Apple's
adoption of a nix core they began to move ahead.  In the last 3-4
years (while we've all been waiting for longhorn to mosey on in from
the range), Apple has made such advances that using windows for any
serious application (and most trivial applications as well) is just
ludicrous.  Windows has become a joke.  Vista is the punchline.

Oh, and before the Linux guys attack me ... I think linux is great as
a server.  In fact, I use it myself.  But for my laptop, I prefer the
macintosh gui over anything out there for linux.

My only request, John, is that you remember to differentiate between
the troubles setting up the database server, and the troubles using
the framework.  I had some user permissions problems as well when I
first set up MySQL.  I mostly use OpenBase, so I'm not really
qualified to solve your MySQL problems, but please don't reject such
a great framework on account of those 5 lines in database.yml

-Derrick S.
john (Guest)
on 2006-03-02 23:53
Andrew VanSpronsen wrote:

How can I thank you enough!!!

I added in the host:localhost to the yml and that seems to have fixed
things. Thanks very much for the input.

I shall now give it another try (tomorrow).

Derrick - agree there is a difference between setting up the database
and using the framework and at the end of the day it will be me who is
disadvantaged if I don't master this - it's just that I have loads of
patience and reasonable (but not comprehensive) knowledge and struggling
just to "open the box" as it were seemed to contradict the "agile" bit
of ruby on rails.

Anyway, I'm on rails now and the database is happy too...

Once again, many thanks for all the input, I really appreciate it.
Ben M. (Guest)
on 2006-03-03 07:35
(Received via mailing list)
john wrote:
> Andrew VanSpronsen wrote:
>
> How can I thank you enough!!!
>
> I added in the host:localhost to the yml and that seems to have fixed
> things. Thanks very much for the input.

That's odd... the ActiveRecord docs say that the default value for host
*is* localhost.
Not sure why adding it would make a difference.

> I shall now give it another try (tomorrow).
>
> Derrick - agree there is a difference between setting up the database
> and using the framework and at the end of the day it will be me who is
> disadvantaged if I don't master this - it's just that I have loads of
> patience and reasonable (but not comprehensive) knowledge and struggling
> just to "open the box" as it were seemed to contradict the "agile" bit
> of ruby on rails.

"Agile" comes after the learning curve... which can be quite long. I
think the many
powerful aspects of rails -- which tends to make for less code than in
other
languages/frameworks -- has unfortunately gotten mutated into "it's so
easy, anyone can do
it", which is far, far from the truth.

b
Derrick S. (Guest)
on 2006-03-03 17:48
(Received via mailing list)
>
> "Agile" comes after the learning curve... which can be quite long.
> I think the many powerful aspects of rails -- which tends to make
> for less code than in other languages/frameworks -- has
> unfortunately gotten mutated into "it's so easy, anyone can do it",
> which is far, far from the truth.

I agree.  The statement should read, "It's so easy, any experienced
programmer can pick it up in a day".

-Derrick
Ben M. (Guest)
on 2006-03-03 19:34
(Received via mailing list)
Hmm, first the OT tirade about windows then this little piece of
arrogance... I nominate
Derrick king ogre of the list! (Though I'm well aware that my fastidious
"best practices"
dogma might earn me such a nomination as well).

:-)

b

PS: I'd actually meet you halfway: "It's so easy, any experienced *Ruby*
programmer can
pick it up in a day" (though they'll still have trouble if they don't
understand web
development).
Derrick S. (Guest)
on 2006-03-03 19:37
(Received via mailing list)
I'll admit to some "ogre" tendencies lately.  Chock it up to a really
bad week...stress and all that...  I'm really a nice guy once you get
to know me :)

Yes, I accept your patch to statement.  I've committed it to the
latest svn trunk.

-Derrick
Ben M. (Guest)
on 2006-03-03 19:44
(Received via mailing list)
LOL.... :-D

b
Richard (Guest)
on 2006-03-23 10:54
Hey people

I have a different problem with mysql
Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS
FROM recipes

If i change the password in database.yml, it gives a nice 'could not log
in', so those settings are correct. If i log in to mysql for my user and
run the above query, it gives the correct result.

Any ideas of what i'm doing wrong?

Richard
Chris Larson (Guest)
on 2006-03-23 17:26
(Received via mailing list)
What OS are you using?
What version of MySQL are you connecting too?
Is MySQL locally hosted?

Chris
Richard (Guest)
on 2006-03-23 19:18
Hi,

Thanks for your response

I'm using debian with mysql 5. I fixed the problem by installing the
libmysql-ruby1.8 package.

Richard
This topic is locked and can not be replied to.