码迷,mamicode.com
首页 > 数据库 > 详细

rails db:create错误

时间:2015-09-09 10:59:13      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:

今天用rails连接mysql后,rake db:create出现这个错误

Couldn‘t create database for {"adapter"=>"mysql2", "encoding"=>"utf8", "pool"=>5, "username"=>"root", "password"=>nil, "socket"=>"/var/run/mysqld/mysqld.sock", "database"=>"myblog_test"}
rake aborted!
Gem::LoadError: 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).

 但是查看project的gemfile后发现已有gemfile,后来经过查看资料发现因为rails版本太新,mysql2的gemfile 不配套 ,所以产生了这个错误。只需要在gemfiel中 把mysql2指定版本即可

gem ‘mysql2‘, ‘~> 0.3.18‘

参考网址:http://stackoverflow.com/questions/22932282/gemloaderror-specified-mysql2-for-database-adapter-but-the-gem-is-not-loade#

 

rails db:create错误

标签:

原文地址:http://www.cnblogs.com/zhangmc/p/4793750.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!