mysql2のbundle installに失敗する時

mac上でbundle installした時に、以下のようなエラーが出て失敗する事がある

```
Fetching mysql2 0.5.3
Installing mysql2 0.5.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.


    current directory: /Users/mapyo/tmp/mysql2_sample/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.3/ext/mysql2
/Users/mapyo/.anyenv/envs/rbenv/versions/2.6.4/bin/ruby -I /Users/mapyo/.anyenv/envs/rbenv/versions/2.6.4/lib/ruby/2.6.0 -r ./siteconf20200113-35739-1ltnc8d.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for rb_wait_for_single_fd()... yes
checking for -lmysqlclient... no
-----
mysql client is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.


Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/Users/mapyo/.anyenv/envs/rbenv/versions/2.6.4/bin/$(RUBY_BASE_NAME)
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysql-config
        --without-mysql-config
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib


To see why this extension failed to compile, please check the mkmf.log which can be found here:


  /Users/mapyo/tmp/mysql2_sample/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-17/2.6.0-static/mysql2-0.5.3/mkmf.log


extconf failed, exit code 1


Gem files will remain installed in /Users/mapyo/tmp/mysql2_sample/vendor/bundle/ruby/2.6.0/gems/mysql2-0.5.3 for inspection.
Results logged to /Users/mapyo/tmp/mysql2_sample/vendor/bundle/ruby/2.6.0/extensions/x86_64-darwin-17/2.6.0-static/mysql2-0.5.3/gem_make.out


An error occurred while installing mysql2 (0.5.3), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'` succeeds before bundling.


In Gemfile:
  mysql2
```


対応方法としては、`--with-mysql-config` のオプションを指定して、bundle configを実行してあげればよかった。。（パスは各自適切な場所になおしてください）

```
bundle config --local build.mysql2 "--with-mysql-config=/usr/local/opt/mysql@5.7/bin/mysql_config"
```



オプションは、これを１つだけ指定しないとうまくいかなかった。 
最初は`with-mysql-dir` などを雑につけてみて試してみていたのだが、それだとbundle installは成功するがその後実際に使う場所でエラーが出てしまった。。。

mysqlの最新のバージョンじゃないものをbrewで入れていて、それを使いたかったからこういうエラーが出てしまうのかもしれない。

というか、READMEをよくみてみるとちゃんと説明が書いてあったので、それを読めばすぐわかったのかもしれない。。

## 参考文献
* https://github.com/brianmario/mysql2/issues/843#issuecomment-297522557
* https://github.com/brianmario/mysql2#configuration-options