RuntimeError with mysql2 and rails3 (bundler)

前端 未结 11 2104
花落未央
花落未央 2020-12-12 20:08

I get this error

`establish_connection\': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record         


        
相关标签:
11条回答
  • 2020-12-12 20:52

    If anybody still facing problem of installing mysql2 gem with rails 3 on Windows, then refer to the detailed steps of installation on -

    http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html

    0 讨论(0)
  • 2020-12-12 20:53

    This also fixed the issue I had with:

    Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter)
    

    You actually need to run: gem install mysql2 and add the gem to your config.

    0 讨论(0)
  • 2020-12-12 20:58

    I had the same error after upgrading from Ubuntu 11.10 to 12.04. This is how I fixed the problem:

    gem uninstall mysql2
    bundle
    

    I think the key here is the 'native extensions' -- I suppose when I installed last, I was using a different version of mysql.

    Installing mysql2 (0.3.11) with native extensions
    
    0 讨论(0)
  • 2020-12-12 21:02

    Also need to change adapter from mysql to mysql2 in database.yml as said here Install mysql2 gem on Snow Leopard for Rails 3 with rvm

    From:

    development: adapter: mysql

    To:

    development: adapter: mysql2

    0 讨论(0)
  • 2020-12-12 21:02

    Same issue for me too. Upgraded to Rails 3.1.rc4 then downgraded to 3.0.3. Worked for me.

    0 讨论(0)
提交回复
热议问题