rails db:create错误
2015-09-09 09:47
337 查看
今天用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指定版本即可
参考网址:http://stackoverflow.com/questions/22932282/gemloaderror-specified-mysql2-for-database-adapter-but-the-gem-is-not-loade#
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#
相关文章推荐
- New package not yet registered with the system. Waiting 3 seconds before next attempt
- POJ 1995 Raising Modulo Numbers(快速幂)
- raid write-bakc write-through的解释
- raid组的初始化详解
- Contains Duplicate
- 游戏人工智能开发之6种决策方法
- 游戏人工智能开发之6种决策方法
- oschinaIM/聊天/语音工具
- oschinaIM/聊天/语音工具
- awaitTermination() shutdown()
- mount: failed, reason given by server: Permission denied
- hdoj 1022 Train Problem I
- 1090. Highest Price in Supply Chain (25)
- Explain分析查询语句
- 1086. Tree Traversals Again (25)
- Netflix开源类库archaius(一)概述
- Contains Duplicate II
- 使用maven的toolchain
- AI设计之Behavior Designer
- BrainFuck解释器