# Problem creating database

**URL:** <https://www.ruby-forum.com/t/problem-creating-database/138260>\
**Category:** Deployment\
**Created:** [May 21, 2008, 1:58pm UTC](https://www.ruby-forum.com/t/problem-creating-database/138260 "2008-05-21T13:58:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuwtnb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/58956e/32.png) [@yuwtnb](https://www.ruby-forum.com/u/yuwtnb)\
**Post date:** [May 21, 2008, 1:58pm UTC](https://www.ruby-forum.com/t/problem-creating-database/138260/1 "2008-05-21T13:58:17Z")

</div>

Hello

I have a problem with creating the database  
using rake command

I have executed the following command but failed.

[root@essen test]# rake db\_setup --trace  
(in /usr/local/lib/ruby/coreware)  
\*\* Invoke db\_setup (first\_time)  
\*\* Invoke db\_connect (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db\_connect  
\*\* Execute db\_setup  
– execute(“create database test\_development”)  
rake aborted!  
No such file or directory - /tmp/mysql.sock  
/opt/rubygems/gems/activerecord-2.0.2/lib/active\_record/vendor/mysql.rb:107:in  
`initialize' /opt/rubygems/gems/activerecord-2.0.2/lib/active_record/vendor/mysql.rb:107:in`new’  
/opt/rubygems/gems/activerecord-2.0.2/lib/active\_record/vendor/mysql.rb:107:in  
`real_connect' /opt/rubygems/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:471:in`connect’  
/opt/rubygems/gems/activerecord-2.0.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:165:in  
`initialize' /opt/rubygems/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:88:in`new’  
/opt/rubygems/gems/activerecord-2.0.2/lib/active\_record/connection\_adapters/mysql\_adapter.rb:88:in  
`mysql_connection' /opt/rubygems/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in`send’  
/opt/rubygems/gems/activerecord-2.0.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:291:in  
`connection=' /opt/rubygems/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:in`retrieve\_connection’  
/opt/rubygems/gems/activerecord-2.0.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:78:in  
`connection' /opt/rubygems/gems/activerecord-2.0.2/lib/active_record/migration.rb:285:in`method\_missing’  
/opt/rubygems/gems/activerecord-2.0.2/lib/active\_record/migration.rb:265:in  
`say_with_time' /usr/local/lib/ruby/1.8/benchmark.rb:293:in`measure’  
/opt/rubygems/gems/activerecord-2.0.2/lib/active\_record/migration.rb:265:in  
`say_with_time' /opt/rubygems/gems/activerecord-2.0.2/lib/active_record/migration.rb:281:in`method\_missing’  
/usr/local/lib/ruby/coreware/lib/tasks/db\_setup.rake:27  
/opt/rubygems/gems/activerecord-2.0.2/lib/active\_record/schema.rb:43:in  
`instance_eval' /opt/rubygems/gems/activerecord-2.0.2/lib/active_record/schema.rb:43:in`define’  
/usr/local/lib/ruby/coreware/lib/tasks/db\_setup.rake:26  
/opt/rubygems/gems/rake-0.8.1/lib/rake.rb:546:in `call' /opt/rubygems/gems/rake-0.8.1/lib/rake.rb:546:in`execute’  
/opt/rubygems/gems/rake-0.8.1/lib/rake.rb:541:in `each' /opt/rubygems/gems/rake-0.8.1/lib/rake.rb:541:in`execute’  
/opt/rubygems/gems/rake-0.8.1/lib/rake.rb:508:in  
`invoke_with_call_chain' /opt/rubygems/gems/rake-0.8.1/lib/rake.rb:501:in`synchronize’  
/opt/rubygems/gems/rake-0.8.1/lib/rake.rb:501:in  
`invoke_with_call_chain' /opt/rubygems/gems/rake-0.8.1/lib/rake.rb:494:in`invoke’  
/opt/rubygems/gems/rake-0.8.1/lib/rake.rb:1931:in `invoke_task' /opt/rubygems/gems/rake-0.8.1/lib/rake.rb:1909:in`top\_level’  
/opt/rubygems/gems/rake-0.8.1/lib/rake.rb:1909:in `each' /opt/rubygems/gems/rake-0.8.1/lib/rake.rb:1909:in`top\_level’  
/opt/rubygems/gems/rake-0.8.1/lib/rake.rb:1948:in  
`standard_exception_handling' /opt/rubygems/gems/rake-0.8.1/lib/rake.rb:1903:in`top\_level’  
/opt/rubygems/gems/rake-0.8.1/lib/rake.rb:1881:in `run' /opt/rubygems/gems/rake-0.8.1/lib/rake.rb:1948:in`standard\_exception\_handling’  
/opt/rubygems/gems/rake-0.8.1/lib/rake.rb:1878:in `run' /opt/rubygems/gems/rake-0.8.1/bin/rake:31 /opt/rubygems/bin/rake:19:in`load’  
/opt/rubygems/bin/rake:19

I have configured the database.yml file as following.

```
  1 development:
  2 adapter: mysql
  3 database: test_development
  4 username: root
  5 password: test
  6 host: localhost
  7 encoding: utf8
  8 socket : /var/lib/mysql/mysql.sock

```

However it seems that the rake command is reading the  
database.yml file…

I also confirmed that there aren’t any file that has  
“/tmp/mysql.sock” in it.

Could I get some advice with this?

Best Regards,  
Yu Watanabe

---

<div class="post-metadata">

**Author:** ![yuwtnb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/58956e/32.png) [@yuwtnb](https://www.ruby-forum.com/u/yuwtnb)\
**Post date:** [May 21, 2008, 2:04pm UTC](https://www.ruby-forum.com/t/problem-creating-database/138260/2 "2008-05-21T14:04:57Z")

</div>

Hello

I have deployed ruby environment on CentOS 4.4.

Thank you.

---

<div class="post-metadata">

**Author:** ![yuwtnb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/58956e/32.png) [@yuwtnb](https://www.ruby-forum.com/u/yuwtnb)\
**Post date:** [May 22, 2008, 1:40am UTC](https://www.ruby-forum.com/t/problem-creating-database/138260/3 "2008-05-22T01:40:40Z")

</div>

You haven’t specified the correct socket for your database, in  
database.yml  
add another line:

socket: /var/run/mysqld/mysqld.sock

Or change it to wherever your socket is.

On Wed, May 21, 2008 at 9:34 PM, Yu Watanabe \<  
removed\_email\_address@domain.invalid\> wrote:

> 

–  
Appreciated my help?  
Recommend me on Working With Rails  
[http://workingwithrails.com/person/11030-ryan-bigg](http://workingwithrails.com/person/11030-ryan-bigg)

---

<div class="post-metadata">

**Author:** ![yuwtnb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/58956e/32.png) [@yuwtnb](https://www.ruby-forum.com/u/yuwtnb)\
**Post date:** [May 23, 2008, 9:42pm UTC](https://www.ruby-forum.com/t/problem-creating-database/138260/4 "2008-05-23T21:42:59Z")

</div>

I’ve found that commenting out the socket line works sometimes  
(especially if it’s incorrect). I would also make sure your mysql gem  
is installed correctly. It has a tendency to both give errors and say  
“1 gem installed” if it gives any errors you need to reinstall it.

On May 21, 7:04 am, Yu Watanabe [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![yuwtnb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/58956e/32.png) [@yuwtnb](https://www.ruby-forum.com/u/yuwtnb)\
**Post date:** [May 26, 2008, 2:03am UTC](https://www.ruby-forum.com/t/problem-creating-database/138260/5 "2008-05-26T02:03:25Z")

</div>

All

Thank you all. I found this was caused by the  
web filtering software that is in the web server.

I tried the gem install command few times and it  
has worked properly.

Thank you
