Rails数据库创建

时间:2013-03-27 17:56:37

标签: ruby-on-rails

当我运行命令rake db:create时 我收到以下消息:

Couldn't create database for {"password"=>"secret1", "username"=>"root", "host"=>"localhost", "database"=>"zooz_development", "encoding"=>"utf8", "port"=>3307,
"adapter"=>"mysql"}, charset: utf8, collation: utf8_unicode_ci (if you set the c
harset manually, make sure you have a matching collation)

我在win7上工作 mysql正在使用端口3307 我已经安装了mysql gem 这是我的database.yml文件:

    development:
  adapter: mysql
  encoding: utf8
  database: zooz_development
  username: root
  password: secret1
  port: 3307
  host: localhost




# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: mysql
  encoding: utf8
  database: chmaysa_test
  username: root
  password: secret1
  port: 3307
  host: localhost


production:
  adapter: mysql
  encoding: utf8
  database: zooz_development
  username: root
  password: secret1
  port: 3307
  host: localhost

1 个答案:

答案 0 :(得分:0)

尝试:

将此添加到Gemfile: gem 'mysql2'

并将适配器从mysql更改为mysql2