2013-04-16 1 views
5

내가 포함 한 보석,DBI :: InterfaceError : 드라이버를로드 할 수 없습니다 (초기화되지 않은 상수 MysqlError)

나는 다음과 같은 코드를 실행 레일 콘솔
dbd-mysql (0.4.4) 
dbi (0.4.5) 
mysql (2.8.1) 

,

require 'rubygems' 
require "dbi" 
require 'dbd-mysql' 
dbh = DBI.connect("DBI:Mysql:TestDB:localhost","username", "pwd") 

1.9.2-p180 :001 > require 'rubygems' 
=> false 
1.9.2-p180 :002 > require "dbi" 
=> false 
1.9.2p180 :003 > require 'dbd-mysql' 
LoadError: no such file to load -- dbd-mysql 
from /.rvm/gems/[email protected]/gems/dbi-0.4.5/lib/dbi.rb:318:in `rescue in load_driver' 
    from /.rvm/gems/[email protected]/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver' 
    from /.rvm/gems/[email protected]/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver' 
    from /.rvm/gems/[email protected]/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect' 
    from (irb):3 
    from /.rvm/gems/[email protected]/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start' 
    from /.rvm/gems/[email protected]/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start' 
    from /.rvm/gems/[email protected]/gems/railties-3.1.1/lib/rails/commands.rb:40:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 

1.9.2-p180 :004 > dbh = DBI.connect("DBI:Mysql:TestDB:localhost","username", "pwd") 
DBI::InterfaceError: Could not load driver (uninitialized constant MysqlError) 
    from /.rvm/gems/[email protected]/gems/dbi-0.4.5/lib/dbi.rb:318:in `rescue in load_driver' 
    from /.rvm/gems/[email protected]/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver' 
    from /.rvm/gems/[email protected]/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver' 
    from /.rvm/gems/[email protected]/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect' 
    from (irb):3 
    from /.rvm/gems/[email protected]/gems/railties-3.1.1/lib/rails/commands/console.rb:45:in `start' 
    from /.rvm/gems/[email protected]/gems/railties-3.1.1/lib/rails/commands/console.rb:8:in `start' 
    from /.rvm/gems/[email protected]/gems/railties-3.1.1/lib/rails/commands.rb:40:in `<top (required)>' 
    from script/rails:6:in `require' 
    from script/rails:6:in `<main>' 
1.9.2-p180 :004 > 

암이 오류가

LoadError: no such file to load -- dbd-mysql 
DBI::InterfaceError: Could not load driver (uninitialized constant MysqlError) 

내 dbd-mysql 보석이 제대로 설치되지 않았습니까? 이 문제를 해결하는 방법을 알려주십시오.

+0

당신이' 'mysql''을 요구해야합니까 구성/database.yml을의 DB 이름을 지정합니다

rails new ProjectName -d mysql 

와 새로운 응용 프로그램을 만들 것 ? –

+0

실제로 블로그에 따라 새롭게 나온 내용입니다. 그래서 그들은 mysql도 필요로했다. 그것이 필요하거나 아닌지 잘 모르겠습니다. – Ashwini

답변

0

내가 당신이라면, 그럼 내가