rake aborted! uninitialized constant Mysql2

前端 未结 4 1478
粉色の甜心
粉色の甜心 2020-12-20 15:04
Goksel-Eryigits-Mac-mini:blog geryit$ rake db:migrate --trace
(in /Users/geryit/Sites/blog)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** E         


        
相关标签:
4条回答
  • 2020-12-20 15:12

    Have you defined

    gem 'mysql2'
    

    in Gemfile? For Rails 3 and Bundler, it's not enough to install the gem, but to include it in Gemfile.

    0 讨论(0)
  • 2020-12-20 15:21

    I was getting 'uninitialized constant Mysql' on Snow Leopard and Rails 3. Adding 'mysql' gem to Gemfile fixed it for me.

    0 讨论(0)
  • 2020-12-20 15:24

    They work together now without any problems. The problem was Mysql version and mysql gem flags. I removed MYSQL 5.5 and installed Mysql 5.1 back. Everything is fixed. Thanks.

    I wrote a blog post about installing, it can be helpful : https://geryit.com/blog/installing-mysql-with-rails-on-mac-os-x-snow-leopard/

    0 讨论(0)
  • 2020-12-20 15:26

    Try uninstalling the mysql gem. It might be conflicting with the mysql2 gem you're using in your database.yml.

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