[英]Rails 2.3.5 - Error installing mysql: ERROR: Failed to build gem native extension.
I tried with gem install mysql and gem list, so I was able to see mysql gem in that list, but when I restarted the server it gives me following error 我尝试使用gem install mysql和gem list,所以我能够在该列表中看到mysql gem,但是当我重新启动服务器时,它给了我以下错误
The bundled mysql.rb driver has been removed from Rails 2.2. 捆绑的mysql.rb驱动程序已从Rails 2.2中删除。 Please install the mysql gem and try again: gem install mysql.
请安装mysql gem,然后重试:gem install mysql。 /Users/.rvm/rubies/ruby-1.8.7-p357/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require': no such file to load -- mysql (MissingSourceFile)
/Users/.rvm/rubies/ruby-1.8.7-p357/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:在`gem_original_require'中:没有要加载的文件-mysql(MissingSourceFile)
I then tried gem install mysql2 It installs mysql but gives the same error when I start the server.. Please help! 然后,我尝试了gem install mysql2它安装了mysql,但是在启动服务器时给出了相同的错误。 Thanks in advance
提前致谢
You have to specify what gems your project includes. 您必须指定您的项目包括哪些宝石。 In Rails 2.2, you did this in the environment config files.
在Rails 2.2中,您是在环境配置文件中执行此操作的。 Change this line in your
environment.rb
: 在您的
environment.rb
更改此行:
config.gem 'mysql'
To this: 对此:
config.gem 'mysql2'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.