SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2009
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problems with MySQL and Ruby.

    Getting the typical "Access denied for user 'root'@'localhost' (using password: NO)" error when trying to rake or view page. I searched all over, but can't seem to figure it out.

    I install the mysql gem, but I am not sure it installed all the way or if it was successful. When I look at the gem list, it's there, when I try to update it, it says there is nothing to update.

    Already moved the LIBMYSQL.DLL file to ruby/bin. I did everything I think I am suppose to.

    Please see screenshot below.
    Attached Images Attached Images

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Is root with no password a valid login for your MySQL install? Maybe you should create a user before trying to connect from your Ruby code.

  3. #3
    SitePoint Member
    Join Date
    Feb 2009
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you take a look at the screenshot, I have the MySQL Query Browser and I made sure that there is no pass,

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,000
    Mentioned
    186 Post(s)
    Tagged
    2 Thread(s)
    I forgot the specific details (they can be found here http://dev.mysql.com/doc/refman/5.0/...d-hashing.html), and it may be unrelated to your problem, but I'm wondering if it's a version thing. MySQL changed the way it hashes passwords between 4 and 5. I had trouble logging into MySQL until I found this
    Start mysqld with the --old-passwords option
    I need to do this even though I too have "no password" on my localhost.

  5. #5
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There are problems with mysql gem on Windows.

    It seems to work only with certain versions of MySQL. I recently had problems with MySQL 5.0.77 and ended up going back to a previous version (MySQL 5.0.18) which worked without error. I choose that version as that was the version running on my development PC and I knew it worked both with the gem and my code. I was also in a hurry as it had taken a lot of time to track down the cause of the problem.

    This thread:

    http://groups.google.com/group/rubyo...dd057c41a72fc5

    Suggests that MySQL 5.0.27 works fine with the mysql gem.

    I expect there are newer versions of MySQL that the gem will work with, but I think you will need to work through them yourself. If you are in a hurry, use version 5.0.27 or 5.0.18 of MySQL. If you have a bit more time step back a version at a time until you find one that works.

  6. #6
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh! And using no password on any Windows system is always a mistake! It caused many unforeseen problems as well as being a security issue.

    I think part of the problem is that no password can be interpreted as either either password = nil or password = "". As a coder you will realise that these are quite different statements. Also the coder who wrote the softare has a choice: do you store something to represent "no password", store a NULL, or just not make an entry if there is no password. They may not document this decision well and future updaters may make a different assumptions causing problems. Having no password adds ambiguity to your installation, and that leads to problems.

    If you are aiming for a trouble free life ALWAYS USE A PASSWORD if there is an option for you to do so.

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,000
    Mentioned
    186 Post(s)
    Tagged
    2 Thread(s)
    I guess I had blocked the little nightmare out of my conscious memory, but now that you mention it I had to do quite a bit of "higher - lower - higher - lower" version installs until I found one that installed OK. And yes, sure enough, it's MySQL version 5.0.27

    To be clear, all my localhost databases have usernames and passwords, it's the "superuser admin" that I left the password as the default blank. Not much of a security risk on my machine as I'm the only one using it, and at the time it was one less thing to deal with in a pesky install process. But you make a good point about empty vs. null. Who knows how many mysterious problems I've dealt with unknowingly because of it? The need to use --old-passwords being one? And it certainly isn't best practice.

  8. #8
    SitePoint Member
    Join Date
    Feb 2009
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey guys, thanks for all your responses. This gives me hope that I am not a complete idiot.

    At work I have 5.1.32 installed and it works ok, but I didn't install it, the main dev guy did. I am going to GoToMeeting to my machine at home with him and he'll try to fix it his way, since he seems to know what he is doing. If that fails I am going to try the 5.0.27 on my own and experiment with --old-password and putting in null as my password.

    I didn't want to use a password because I wanted to eliminate all the possible issues that could go wrong. I would surely use a password once the db in the actual dc.

    Thanks again and I will keep you updated if there is news.

  9. #9
    SitePoint Member
    Join Date
    Feb 2009
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey fellas, good news! I installed 5.0.27 and it works! Thank you so much for all your help and input. I am glad that this "little nightmare", as Mittineague rightfully put it, is over.

    Thanks again!
    -nu


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •