3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

brew upgradeしたらrails sでエラーになった

Last updated at Posted at 2015-12-15

Macのローカル開発環境でbrew upgradeしたらrails sでエラーになった。

エラー確認
rake rails:update:bin

エラー
mysqlがゴニョゴニョ.... Library not loaded: /usr/local/lib/libmysqlclient.18.dylib

ネットではlibmysqlclient.18.dylibにリンクを貼ればOKとあるが動かない。

今回の環境はこれで固定されてます
ruby 2.2.0
rails 4.2.0
mysql2 0.3.18

原因はbrew upgradeでmysqlのバージョンが5.6系から5.7系に上がったため。

homebrewの場合

ln -s /usr/local/Cellar/mysql/5.6.25/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib
上記のリンクの貼り直しのみで上手くいくmacもあったが、ダメなmacはmysqlを入れ直した

5.6系に戻す

  1. brewで5.6系を探す
    brew search mysql
  2. バックアップ
    mv /usr/local/var/mysql /usr/local/var/mysql_buckup
  3. uninstall
    brew cleanup mysql
    brew uninstall mysql
  4. 5.6系インストール
    brew install homebrew/versions/mysql56
  5. mysqlユーザー作成
    mysql root -u
    -> 'hoge'@'localhost' identified by 'hoge';```
6.   
```rails s```
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?