我是Ruby on rails的新手。我正在运行此命令rake db:create
但是我遇到了以下错误。我确实安装了mysql。
Zafars-MacBook-Pro:erierb zafar$ rake db:create
rake aborted!
dlopen(/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `<top (required)>'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
/Users/zafar/Desktop/erierb/config/application.rb:13:in `<top (required)>'
/Users/zafar/Desktop/erierb/Rakefile:5:in `require'
/Users/zafar/Desktop/erierb/Rakefile:5:in `<top (required)>'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:in `eval'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)
以下是我的database.yml文件
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: erierb_development
pool: 5
username: root
password:
socket: /tmp/mysql.sock
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: erierb_test
pool: 5
username: root
password:
socket: /tmp/mysql.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: erierb_production
pool: 5
username: root
password:
socket: /tmp/mysql.sock
这是我的宝石文件
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
# 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'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
group :development, :test do
gem 'rspec-rails'
end
# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'