If this error keeps happening and will not install by manually installing gem install mysql2
. Try the fix below.
An error occurred while installing mysql2 (0.5.1) , and bundler cannot continue.
$ gem install mysql2 -v '0.5.1' -- --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include
$ bundle config set --global build.mysql2 --with-ldflags=-L/usr/local/opt/openssl/lib --with-cppflags=-I/usr/local/opt/openssl/include