Rolling with Ruby on Rails, Part 2
Subject:   getting the database to work with the password
Date:   2005-04-04 15:54:54
From:   co_banzai
So, according to the author, RoR can work with a MySQL database configured with a password. I've set up my system as described by the author, except that I did require a password for the database. I then entered the database password in the config/database.yml file. However, when I try access the page, I get the following error:

Access denied for user 'root'@'localhost' (using password: NO)

From this, it appears that the password is not being passed to MySQL. I've checked the FAQs and the change logs for release 0.9.4 (which is when this was added I think), and I can't figure out what I'm doing wrong. I suspect it's something obvious in the configuration, but if someone could point me in the right direction, I'd be much obliged.

Main Topics Oldest First

Showing messages 1 through 3 of 3.

  • getting the database to work with the password
    2005-04-07 16:43:11  olifante [View]

    I got the same error message, until I shut down the mysqld daemon I had started manually. I forgot that mysqld was configured to start automatically on my machine. Apparently it was simply a conflict between two instances of mysqld running on the same machine.
  • getting the database to work with the password
    2005-04-05 07:26:45  co_banzai [View]

    Ughhhhh... sorry, I'm stupid. I restarted the server and now it all works just fine. I guess the database.yanl file is only read on startup.
  • Curt Hibbs photo getting the database to work with the password
    2005-04-04 19:37:32  Curt Hibbs | O'Reilly AuthorO'Reilly Blogger [View]

    yaml files can be sensitive to format, so make sure your "password:" line starts with two spaces and has a single space after the colon, followed by the password itself. Make sure you don't have any extraneous unprintable characters (a hex editor helps here).

    Also, it should use the "development:" section by default, but just to be sure you should also set the test and production sections.

    Finally, make sure you can access your MySql database with that username/password using some other software (like MySql-Front) to verify that you can, in fact, access your database.