2014-01-07 33 views
2

我正在使用Fedora19。耙子中止!无法加载这样的文件 - mysql/mysql_api

[[email protected] coffee]# ruby -v 
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux] 
[[email protected] coffee]# rails -v 
Rails 3.0. 

这是我的Gemfile

source 'http://rubygems.org' 

gem 'rails', '3.0.9' 

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


gem 'mysql' 

# Use unicorn as the web server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) 
# gem 'ruby-debug' 
# gem 'ruby-debug19', :require => 'ruby-debug' 

# Bundle the extra gems: 
# gem 'bj' 
# gem 'nokogiri' 
# gem 'sqlite3-ruby', :require => 'sqlite3' 
# gem 'aws-s3', :require => 'aws/s3' 

# Bundle gems for the local environment. Make sure to 
# put test-only gems in this group so their generators 
# and rake tasks are available in development mode: 
# group :development, :test do 
# gem 'webrat' 
# end 

当我做耙分贝:迁移,我得到这个错误

[[email protected] coffee]# rake db:migrate 
rake aborted! 
cannot load such file -- mysql/mysql_api 
/home/charul/coffee/config/application.rb:7:in `<top (required)>' 
/home/charul/coffee/Rakefile:4:in `<top (required)>' 
(See full trace by running task with --trace) 

MySQL是安装在我的系统。

[[email protected] coffee]# service mysqld restart 
Redirecting to /bin/systemctl restart mysqld.service 

这是我的database.yml文件。

development: 
    adapter: mysql 
    encoding: utf8 
    database: ajax 
    username: root 
    password: root123 
    host: 127.0.0.1 
    port: 3306 

另外,bundle install命令可以很好地工作。

[[email protected] coffee]# bundle install 
Using rake (10.1.1) 
Using abstract (1.0.0) 
Using activesupport (3.0.9) 
Using builder (2.1.2) 
Using i18n (0.5.3) 
Using activemodel (3.0.9) 
Using erubis (2.6.6) 
Using rack (1.2.8) 
Using rack-mount (0.6.14) 
Using rack-test (0.5.7) 
Using tzinfo (0.3.38) 
Using actionpack (3.0.9) 
Using mime-types (1.25.1) 
Using polyglot (0.3.3) 
Using treetop (1.4.15) 
Using mail (2.2.20) 
Using actionmailer (3.0.9) 
Using arel (2.0.10) 
Using activerecord (3.0.9) 
Using activeresource (3.0.9) 
Using json (1.8.1) 
Using mysql (2.9.1) 
Using bundler (1.3.5) 
Using rdoc (3.12.2) 
Using thor (0.14.6) 
Using railties (3.0.9) 
Using rails (3.0.9) 
Your bundle is complete! 
Use `bundle show [gemname]` to see where a bundled gem is installed. 

谁能帮助如何解决this..thanks

+1

试试'宝石'mysql2''和米ysql安装在你的系统中..? – Nithin

+0

不,它没有奏效。仍然有相同的错误 – Charul

+0

你的yml文件是什么样子? –

回答

0
env ARCHFLAGS="-arch x86_64" gem install mysql --version '2.8.1' -- --with-mysql- config=/usr/local/Cellar/mysql/5.5.15/bin/mysql_config 
1

而应该用mysql宝石mysql2。只要做到:

gem install mysql2

改变你的数据库适配器在您的database.yml文件

development: 
    adapter: mysql 

development: 
    adapter: mysql2 

,改变你的Gemfile:

#gem 'mysql' 
gem 'mysql2' 
相关问题