15
10

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 mysql で v8 がインストールされて rails server が起動しなくなったので v5.7 に戻す

Posted at

カジュアルに brew upgrade mysql を実行してしまい、v8 がインストールされていました。
手元で rails server できなくなったので v5.7 に戻した手順です。

記憶によれば、このようなエラーが表示される件。
取り急ぎのメモ。

mysql client is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.

MySQL

MySQL v5.7 をインストールし直します。

% brew uninstall mysql
Uninstalling /usr/local/Cellar/mysql/8.0.11... (254 files, 232.6MB)
% brew install mysql@5.7

~/.zshrc にパスを追加します。
DYLD_LIBRARY_PATH が必須かどうか不明。

~/.zshrc
# for MySQL v5.7
export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"
export DYLD_LIBRARY_PATH="/usr/local/opt/mysql@5.7/:$DYLD_LIBRARY_PATH"

~/.zshrc を読込直し、サービスを起動します。

% source ~/.zshrc
% brew services start mysql@5.7
==> Successfully started `mysql@5.7` (label: homebrew.mxcl.mysql@5.7)

Rails

mysql2 のバージョンを指定します。

Gemfile
gem 'mysql2', '~> 0.4.9'

bundle install し直します。

% bundle exec gem uninstall mysql2
% bundle install  

補遺

15
10
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
15
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?