# MySQL problem: #28000Access denied for user

**URL:** <https://discuss.rubyonrails.org/t/mysql-problem-28000access-denied-for-user/14846>\
**Category:** rubyonrails-talk\
**Created:** [June 24, 2007, 5:27pm UTC](https://discuss.rubyonrails.org/t/mysql-problem-28000access-denied-for-user/14846 "2007-06-24T17:27:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mister\_Yu](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Mister\_Yu](https://discuss.rubyonrails.org/u/Mister_Yu)\
**Post date:** [June 24, 2007, 5:27pm UTC](https://discuss.rubyonrails.org/t/mysql-problem-28000access-denied-for-user/14846/1 "2007-06-24T17:27:49Z")

</div>

Hi All,

sorry if i asked a very stupid question.

i am new for ROR and i dont have too much admin skill for MySQL. i have trouble on setting up the database connection, for my ROR. when i just run a simple scaffold controller, i've got this error message:

Mysql::Error in BlogController#index #28000Access denied for user 'erv2'@'localhost' (using password: YES) RAILS\_ROOT: ./script/../config/..

here is the setting of my database.yml file: &nbsp;&nbsp;adapter: mysql &nbsp;&nbsp;database: mapapp &nbsp;&nbsp;username: erv2 &nbsp;&nbsp;password: 000000 &nbsp;&nbsp;host: localhost

here is the screen shot of the MySQL Adminstrator, showing that i gave access to "erv2@localhost": [![](https://global.discourse-cdn.com/rubyonrails/original/2X/6/6ce16fc089227219f39c4bc9df755ed5d7bc0a0e.jpeg) ](https://lh3.googleusercontent.com/image/eryan.yu/Rn6ouEu86II/AAAAAAAAAHA/iG59n7UhbGo/Capture_7.jpg)

I spent two days working on this problem, searching everywhere for solutions, but none of them solves my problem.

i dont think it's a very hard problem, i may just have missed some tiny little thing. can someone give me some hints? i really want to get going on making my first webapp.

thank you very much.

---

<div class="post-metadata">

**Author:** ![Val](https://avatars.discourse-cdn.com/v4/letter/v/e56c9b/32.png) [@Val](https://discuss.rubyonrails.org/u/Val)\
**Post date:** [June 24, 2007, 8:00pm UTC](https://discuss.rubyonrails.org/t/mysql-problem-28000access-denied-for-user/14846/2 "2007-06-24T20:00:34Z")

</div>

Most likely the problem is with your password. You expect it to be a string '0000000' when rials connects to a DB, but in reality, since database.yml is processed by YAML, it is a in integer 0. You need to quote strings that can be interpreted as something else in YAML files. In your case, the config should be: &nbsp;&nbsp;adapter: mysql &nbsp;&nbsp;database: mapapp &nbsp;&nbsp;username: erv2 &nbsp;&nbsp;password: "000000" &nbsp;&nbsp;host: localhost

To show you how it works:

> > YAML.load 'password: 000000'

=\> {"password"=\>0}

> > YAML.load 'password: "000000"'

=\> {"password"=\>"000000"}

Don't forget to bounce the application after changing the config 😉

Val [http://revolutiononrails.blogspot.com/](http://revolutiononrails.blogspot.com/)

---

<div class="post-metadata">

**Author:** ![Mister\_Yu](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@Mister\_Yu](https://discuss.rubyonrails.org/u/Mister_Yu)\
**Post date:** [June 24, 2007, 11:46pm UTC](https://discuss.rubyonrails.org/t/mysql-problem-28000access-denied-for-user/14846/3 "2007-06-24T23:46:02Z")

</div>

spot on!

this is THE place!

thank you so much!!!
