开发者

Why can't I create my database using "rake db:create"?

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"=>"************",开发者_如何学Go "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?


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).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜