Could not load 'active_record/connection_adapters/mysql2_adapter'

运行 
rake db:migrate

报如下错误:

LoadError: Could not load 'active_record/connection_adapters/mysql2_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.

LoadError: libmysqlclient.so.18: cannot open shared object file: No such file or directory - /home/drjr/opt/ruby-2.4.1/lib/ruby/gems/2.4.0/gems/mysql2-0.4.5/lib/mysql2/mysql2.so


原因是mysql从5.6升级到5.7了,mysql2这个gem的版本是0.4.3,有点老了,不能支持mysql5.7。mysql2升级到0.4.9,就OK了。

猜你喜欢

转载自samwalt.iteye.com/blog/2396334
今日推荐