一千萬個為什麽

搜索

在Fedora上安裝MySQL gem的問題

當我嘗試rake db:migrate時,我收到以下錯誤:

The bundled mysql.rb driver has been removed from Rails 2.2.
Please install the MySQL gem and try again: gem install mysql.
rake aborted! no such file to load -- mysql

And when I try to gem install mysql

Building native extensions. This could take a while... ERROR: Error installing
mysql: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb
Can't find header files for ruby. Gem files will remain installed in
/usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.

$ sudo gem install MySQL - --with-mysql-config =/usr/local/mysql/bin/mysql_config

也嘗試了但同樣的錯誤。我在Fedora 10上。非常感謝幫助。歡呼!

最佳答案

在安裝MySQL gem之前,您需要安裝Ruby和MySQL的Fedora開發包。嘗試:

$ sudo yum -y install gcc mysql-devel ruby-devel rubygems

然後重試你的:

$ sudo gem install MySQL -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

(還要檢查/ usr/local/mysql/bin是mysql_config的正確位置,它可能是/ usr/bin。)

轉載註明原文: 在Fedora上安裝MySQL gem的問題