无法创建数据库

时间:2013-07-02 13:49:17

标签: ruby-on-rails cloudcontrol

我在cloudcontrol应用程序上创建数据库时出现问题:

xxx:~/Sites/e_paper$ cctrlapp epaper/default run "rake db:create"
Couldn't create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "database"=>"xxx", "host"=>"mysqlsdb.xxx.eu-west-1.rds.amazonaws.com", "port"=>3306, "username"=>"xxx", "password"=>"xxx"}, charset: utf8, collation: utf8_unicode_ci
(if you set the charset manually, make sure you have a matching collation)
Connection to ssh.cloudcontrolled.net closed.

我的database.yml看起来像这样:

production:
  adapter: mysql2
  encoding: utf8
  pool: 5
  database: <%= "'#{ ENV['MYSQLS_DATABASE'] }'" %>
  host: <%= "'#{ ENV['MYSQLS_HOSTNAME'] }'" %>
  port: <%= ENV["MYSQLS_PORT"] %>
  username: <%= "'#{ ENV['MYSQLS_USERNAME'] }'" %>
  password: <%= "'#{ ENV['MYSQLS_PASSWORD'] }'" %>

网站上的凭据匹配。

有什么想法吗?

1 个答案:

答案 0 :(得分:2)

您需要做的就是将池大小减小到2(对于免费的mysql插件)。这个配置对我有用:

production:
  adapter: mysql2
  encoding: utf8
  pool: 2
  database: <%= "'#{ ENV['MYSQLS_DATABASE'] }'" %>
  host: <%= "'#{ ENV['MYSQLS_HOSTNAME'] }'" %>
  port: <%= ENV["MYSQLS_PORT"] %>
  username: <%= "'#{ ENV['MYSQLS_USERNAME'] }'" %>
  password: <%= "'#{ ENV['MYSQLS_PASSWORD'] }'" %>