views:

370

answers:

2

I've recently started reading up on Rails and while getting my development environment ready on Windows, I kept running into problems. So I opted to just work on the server space I have with asmallorange.com.

Everything went smoothly until I tried created my database.

When running

rake db:create

I get a response saying that it could not create a database. There is no relevant error with the response and there's no errors in the log files. My PuTTY session looks like this:

[~]# cd alist
[~/alist]# rake db:create
(in /home/jonnie/alist)
Couldn't create database for {"socket"=>"/var/lib/mysql/mysqld.sock", "reconnect"=>false, "encoding"=>"utf8", "username"=>"admin", "adapter"=>"mysql", "password"=>"************", "database"=>"alist_development", "pool"=>5}, charset: utf8, collation: utf8_general_ci (if you set the charset manually, make sure you have a matching collation)

And my database.yml file looks like this:

development:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: alist_development
  pool: 5
  username: admin
  password: ************
  socket: /var/lib/mysql/mysqld.sock

test:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: alist_test
  pool: 5
  username: admin
  password: ************
  socket: /var/lib/mysql/mysqld.sock

production:
  adapter: mysql
  encoding: utf8
  reconnect: false
  database: alist_production
  pool: 5
  username: admin
  password: ************
  socket: /var/lib/mysql/mysqld.sock

I'm pretty stuck at this point, and I haven't been able to find an answer anywhere else. Anyone know what's up? Is there something I'm doing wrong or should I contact my host with the problem?

+3  A: 

Probably the user you have on your hosting doesn't have the privileges to create databases...maybe you will have to create the database from hosting tools (from cpanel, for example).

rATRIJS
This was the problem. I created my databases manually like you suggested and everything is working now. Thanks!
Jonnie
+1  A: 

Also, are you sure /var/lib/mysql/mysqld.sock is the proper place for the socket? It might be that the mysql installation is configured for putting sockets in /tmp or somewhere else.

neutrino