0

我正在尝试使用 mysql 制作 rails 3.1 应用程序,这是我第一次使用它,当我尝试rake db:create

错误

无法通过套接字 '/tmp/mysql.socket' 连接到本地 MySQL 服务器 (2) 无法为 { database.yml info in here } 创建数据库(如果您手动设置字符集,请确保您有匹配的排序规则)

我正在查看此链接http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard/发布在此问题中rake db:create - collat​​ion issues

但我认为这不适用,当我安装 gem mysql 'gem-version' 时不会安装 mysql 吗?有人可以帮我解决这个错误吗?我也在运行 osx 10.7

非常感谢您!

这就是我的 gem 文件的样子

gem 'rails', '3.2.13'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem "mysql2"
gem "activerecord-mysql2-adapter"

gem 'pry'
gem 'pry-debugger'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end
    group :development, :test do
        gem 'rspec-rails', '~> 2.0'
        gem 'database_cleaner'
        gem 'shoulda-matchers'
    end

    gem 'jquery-rails'

我的数据库.yml

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: Training_development
  pool: 5
  username: root
  password:
  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: mysql2
  encoding: utf8
  reconnect: false
  database: Training_test
  pool: 5
  username: root
  password:
  host: localhost

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: Training_production
  pool: 5
  username: root
  password:
  host: localhost
4

0 回答 0