Please install mysql adapter 'gem install activerecord-mysql-adapter'

前端 未结 16 1402
挽巷
挽巷 2020-12-28 12:23

I\'m having trouble finding a solution to this problem. I\'m getting the error:

Please install the mysql adapter: \'gem install activerecord-mysql-adapter\'
         


        
相关标签:
16条回答
  • 2020-12-28 12:49

    What helped for me was specifying adapter mysql2 instead of mysql (note the digit!) in config/database.yml.

    0 讨论(0)
  • 2020-12-28 12:52

    The problem is on your file config/database.yml

    You should have a line that specify that the adapter is mysql2 (and not mysql)

    adapter: mysql2
    

    Instead of

    adapter: mysql
    
    0 讨论(0)
  • 2020-12-28 12:52

    Step 1. gem 'mysql2', "~>0.3.11" instead of gem 'mysql2' in Gemfile

    Step 2. putting mysqllib.dll (available at mysql installation C:\wamp\bin\mysql\mysql5.5.24\lib ) in the C:\ruby2.0.0\bin folder solved the rake db:migrate problem and successfully connected my rails with mysql (database.yml contains mysql2)

    I'm running windows 7, 64bit, mysql 64bit, ruby 2.0.0 [x64-mingw32]

    Thanks you all for your inputs.

    0 讨论(0)
  • 2020-12-28 12:52

    For a old rails 2.3.18 ruby 1.8.7 app that I 'migrated' to a new MacBook (High Sierra - 10.13.6), in order to get the app to run (using POW) and to use script/console, I had to disable SIP and create a link to a file in /urs/lib/ directory. Migration Assistant was unable to create the link because of SIP.

    To Disable SIP - System Integrity Protection

    1. Boot into Mac OS Recovery Mode as usual by holding down the Command and R keys during system start.

    2. Choose the language as usual (if applicable)

    3. At the “MacOS Utilities” screen, pull down the “Utilities” menu from the top of the screen.

    4. In terminal, type command: csrutil disable

    5. Restart your computer

    Finally, after restarting, in Terminal enter this command:

    sudo ln /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

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

    This might be late but bundle install was installing 0.4.0 So I tried to edit the gem file and I replace mysql2 with

    gem 'mysql2', "~>0.3.11"

    and then

    bundle install

    in the terminal (This will install mysql2 0.3.11 and not the last version) I think active record have problems working with the last version. Well I hope it helps

    0 讨论(0)
  • 2020-12-28 12:55

    If nothing helps (you have mysql2 as adapter in your database.yml) and you are using RVM to manage your ruby versions, here is the simplest solution:

    Try to remove all of your old gemsets (including global), install a fresh ruby version and bundle again. I could solve the problem that way.

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