Rails:为数据库适配器指定了"mysql2",但未加载gem [英] Rails: Specified 'mysql2' for database adapter but the gem is not loaded
问题描述
显然,有一个线程可以解决此问题.但是我已经尝试运行解决方案中给出的那些命令.由于某些原因,我仍然遇到相同的错误.
apparently there is a thread that addresses this issue . But I have already tried to run those commands given in the solution. I am still getting the same error for some reason.
我跑步
gem install mysql2 -v 0.3.18
之后
bundle install
在我的终端上.然后我通过键入以下命令启动服务器 Rails服务器
on my terminal. And than I start the server by typing rails server
打开localhost:3000后.我收到同样的错误.
Upon opening the localhost:3000. I receive the same error.
为数据库适配器指定了"mysql2",但未加载gem.将
gem 'mysql2'
添加到您的Gemfile中(并确保其版本为ActiveRecord要求的最低版本).
Specified 'mysql2' for database adapter, but the gem is not loaded. Add
gem 'mysql2'
to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).
任何帮助将不胜感激.
Any help would be much appreciated.
推荐答案
将以下内容添加到您的Gemfile
:
Add the following to your Gemfile
:
gem 'mysql2', '~> 0.3.18'
然后运行:
bundle install
这篇关于Rails:为数据库适配器指定了"mysql2",但未加载gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!