I recently updated mysql to mysql8.0.4
from mysql5.7
. I updated the mysql2 gem from 0.4.9
to 0.5.3
After that I starts getting the below error :
/Users/user/.rvm/gems/ruby-2.4.0@talent_now/gems/activerecord-5.1.4/lib/active_record/connection_adapters/connection_specification.rb:188:in `rescue in spec':
Specified 'mysql2' for database adapter, but the gem is not loaded. Add `gem 'mysql2'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
I tried to downgrade mysql2 to 0.4.9
but then I got
/usr/local/Cellar/mysql/8.0.25_1/include/mysql/mysql.h:187:3: note: 'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
client.c:1315:38: error: use of undeclared identifier 'MYSQL_SECURE_AUTH'; did you mean 'MYSQL_DEFAULT_AUTH'?
return _mysql_client_options(self, MYSQL_SECURE_AUTH, value);
^~~~~~~~~~~~~~~~~
MYSQL_DEFAULT_AUTH
/usr/local/Cellar/mysql/8.0.25_1/include/mysql/mysql.h:187:3: note: 'MYSQL_DEFAULT_AUTH' declared here
MYSQL_DEFAULT_AUTH,
^
2 errors generated.
make: *** [client.o] Error 1
make failed, exit code 2
I am using Rails5.1.4
in mac catalina
mysql2 0.5.x
is not compatible with Rails5.1.4
,
so I updated Rails
to 5.1.7
to make it work.
mysql2 0.5.x works with Rails / Active Record 4.2.11, 5.0.7, 5.1.6, and higher.
Above is mentioned on the mysql2 documentation.