2013-04-16 9 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 > 

Am यह त्रुटि मिलती

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

क्या मेरा डीबीडी-माइस्क्ल मणि ठीक से स्थापित नहीं है? कृपया कोई मुझे इस मुद्दे को हल करने का सुझाव देता है?

+0

आप 'mysql'' की आवश्यकता के लिए 'की ज़रूरत है

rails new ProjectName -d mysql 

के साथ एक ब्रांड के नए एप्लिकेशन बनाना होगा ? –

+0

वास्तव में इसके लिए नया है, इसलिए बस ब्लॉग का पालन करें। उसमें उन्हें MySQL भी चाहिए। तो सुनिश्चित नहीं है कि इसकी आवश्यकता है या नहीं – Ashwini

उत्तर

0

अगर मैं तुम्हें थे, मैं तो मैं कॉन्फ़िग/Database.yml में DB नाम निर्दिष्ट करना होगा

संबंधित मुद्दे