Access denied for root@localhost


when i run this command: rake db:schema:load i get:

access denied for root@localhost

i’m 101% sure i entered the correct login name and password in
config\database.yml. i can go inside mysql environment using the
credentials in database.yml. i also tried to run ruby script/console and
i was able to get to the development environment.

are there any config file that i missed?

thank you!

Hi, can you access the database from the command?

On Sat, Jul 26, 2008 at 10:59 PM, Joey B.
<[email protected]

Conrad T. wrote:

Hi, can you access the database from the command?


like if i do?

mysql -u root -p

then yes. same user and password in database.yml file. i can’t quite
figure out what is missing in my rails app.


Looks like a mysql issue…

try this:

mysql> show grants for root@localhost;

Should give you something like this:

| Grants for root@localhost
1 row in set (0.02 sec)

This is root access to . all databases with NO password… if there
is an identified by then you have a password…

Looks like an issue with mysql grants too me.

When you access mysql from the command line and run \s what does it
say under current user? root@localhost? or [email protected] ?

Maye you have access to “see” the database but doing schema load you
might be missing the correct CREATE,INSERT grants?

Here would be the give all access command:

grant all on your_database.* to ‘root’@‘localhost’ identified by

hi heimdull,

thank you for your time. i did as you suggested but still can’t get
through this problem.

as mentioned, i am able to go to mysql environment using the same user
name and password in config/database.yml. likewise, i can also go inside
rails’ development environment through ruby script/server.

what’s more puzzling is if i generate a new app, (ie. rails testap),
then make config/database.yml similar with the other, it does work fine.
i should also mention that i’m trying to install coupa.

any other ideas why a rake db:schema:load would return the access denied

i noticed that sometimes the error messages returned by rake(?) does not
actually relate to the actual problem. so this could be one of those.

thank you!