# Database error when running Test

**URL:** <https://www.ruby-forum.com/t/database-error-when-running-test/110932>\
**Category:** Rails\
**Created:** [August 1, 2007, 5:43am UTC](https://www.ruby-forum.com/t/database-error-when-running-test/110932 "2007-08-01T05:43:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![desertfox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8491ac/32.png) [@desertfox](https://www.ruby-forum.com/u/desertfox)\
**Post date:** [August 1, 2007, 5:43am UTC](https://www.ruby-forum.com/t/database-error-when-running-test/110932/1 "2007-08-01T05:43:01Z")

</div>

Hello,

I thought my database connection was working after I was able to migrate  
my schema to the database, but after I setup a simple test and ran rake  
I get the following error:

/usr/local/bin/ruby -Ilib:test  
“/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake/rake\_test\_loader.rb”  
No such file or directory - /tmp/mysql.sock

My database.yml file looks like this:  
development:  
adapter: mysql  
database: emporium\_development  
username: root  
password: root  
host: localhost  
socket: /Applications/MAMP/tmp/mysql/mysql.sock

Im using MAMP as my database management system.

Can someone help please?

---

<div class="post-metadata">

**Author:** ![desertfox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8491ac/32.png) [@desertfox](https://www.ruby-forum.com/u/desertfox)\
**Post date:** [August 1, 2007, 8:22am UTC](https://www.ruby-forum.com/t/database-error-when-running-test/110932/2 "2007-08-01T08:22:30Z")

</div>

Hey,  
You’ll need to setup a test database as well if your trying to run  
Unit Tests etc.  
Rails uses different DB’s for dev, test and production

Convention would be the following:  
test:  
adapter: mysql  
database: emporium\_test  
username: root  
password: root  
host: localhost  
socket: /Applications/MAMP/tmp/mysql/mysql.sock

Add that to you database.yml file first and then make a new DB called  
emporium\_test and all should be fine.

Cam
