ActiveRecord… activerecord-mysql-adapter

前端 未结 4 2098
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-20 07:12

This is driving me farking insane.

I\'m trying to create a simple beginner app utilizing ActiveRecord to do simple database tasks. I\'m NOT using rails.

I keep g

相关标签:
4条回答
  • 2021-02-20 07:53
    1. I issued bundle install command, which didn't resolve the issue

    2. I found the gemfile located in c:\Sites\<>\Gemfile

    3. Added gem 'mysql' to the file by editing it in notepad++

    4. Then checked whether Mysql is avilable in the bundle using bundle show mysql

    5. After which when i issued rake db:create , I got specified file could not be found error which is was referring to libmysql.dll

    6. You can find the same in your mysql installation or you can download from the link http://www.vertstudios.com/blog/libmysqldll-32-bit-download/

    7. Copy that file to the Ruby directory bin folder. In My case I was using rubyinstaller so it was C:\RailsInstaller\Ruby1.9.3\bin

    Voila. That's done.

    ^Note that the download link might lead to an incorrect library version. In which case, it's best to follow the link given in the message you get right after installing the mysql(2) gem to get the correct library version, otherwise it still won't work.

    0 讨论(0)
  • 2021-02-20 07:56

    Not sure if this is your problem but try using the adapter: mysql2 driver. It's the recommended anyway since it's way faster than the standard mysql one.

    Do you still get the same issue?

    0 讨论(0)
  • 2021-02-20 08:02

    After hours of fighting with this issue, Tallboy's answer worked for me on OS X:

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

    Unfortunately his answer was hidden in one of the comments above; you have to click the link to expand the comment. I was getting the error message "undefined method 'init' for Mysql:Class"

    0 讨论(0)
  • 2021-02-20 08:04

    We faced the same problem (because we switch from jruby to ruby)

    Solved with :

    • adapter: mysql2 (in database.yml)
    • gem 'mysql2' (in the gemfile)
    0 讨论(0)
提交回复
热议问题