# MySQL Unit Test Login Failure

**URL:** <https://www.ruby-forum.com/t/mysql-unit-test-login-failure/133975>\
**Category:** Rails\
**Created:** [April 5, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/mysql-unit-test-login-failure/133975 "2008-04-05T23:19:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![newrubygirl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@newrubygirl](https://www.ruby-forum.com/u/newrubygirl)\
**Post date:** [April 5, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/mysql-unit-test-login-failure/133975/1 "2008-04-05T23:19:18Z")

</div>

I just recently started having issues running unit tests for my  
application, but can’t figure out why. When I run rake test:units, I  
get “Access denied for user ‘root@localhost’ using password: NO”.

My database.yml file is configured to use the ODBC login, but it’s not  
being passed to my unit tests. Any ideas?

development:  
adapter: mysql  
encoding: utf8  
database: db\_development  
username: ODBC  
password:  
socket: /tmp/mysql.sock

test:  
adapter: mysql  
encoding: utf8  
database: db\_test  
username: ODBC  
password:  
socket: /tmp/mysql.sock

---

<div class="post-metadata">

**Author:** ![newrubygirl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@newrubygirl](https://www.ruby-forum.com/u/newrubygirl)\
**Post date:** [April 6, 2008, 8:41am UTC](https://www.ruby-forum.com/t/mysql-unit-test-login-failure/133975/2 "2008-04-06T08:41:26Z")

</div>

U have odbc as the user for test db. But u have root as user in mysql.  
Either change odbc to root or create odbc user in mysqladmin.

[Http://www.rubyplus.org](Http://www.rubyplus.org)  
Free Ruby & Rails screencasts

On Apr 5, 2008, at 2:19 PM, Becca G. \<rails-mailing-list@andreas-

---

<div class="post-metadata">

**Author:** ![newrubygirl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@newrubygirl](https://www.ruby-forum.com/u/newrubygirl)\
**Post date:** [April 6, 2008, 9:37pm UTC](https://www.ruby-forum.com/t/mysql-unit-test-login-failure/133975/3 "2008-04-06T21:37:40Z")

</div>

Bcp wrote:

> U have odbc as the user for test db. But u have root as user in mysql.  
> Either change odbc to root or create odbc user in mysqladmin.

I have both the root and ODBC users set up in mysql. I thought that the  
database.yml file would tell the tests to use the ODBC user instead of  
the root user. Is there some other location where the test is getting  
the user?

---

<div class="post-metadata">

**Author:** ![newrubygirl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@newrubygirl](https://www.ruby-forum.com/u/newrubygirl)\
**Post date:** [April 6, 2008, 11:19pm UTC](https://www.ruby-forum.com/t/mysql-unit-test-login-failure/133975/4 "2008-04-06T23:19:05Z")

</div>

After digging around the environment was being set in another spot, so  
as soon as I commented that out, everything worked great.
