LoginSignup
1
1

More than 5 years have passed since last update.

HomebrewでMySQL5.6を使い続ける

Last updated at Posted at 2016-06-09

Homebrewを使ってMySQL環境を得ている場合、何気なく brew update && brew upgrade をしているとMySQLのバージョンが5.7に上がっていて、罠にハマることが多い。
そこでMacOS上のMySQLを5.6に固定したままにする方法を紹介。

既存のmysqlを削除する

# mysqlを停止
$ mysql.server stop
# 自動起動設定をOFF
$ launchctl remove homebrew.mxcl.mysql
# mysql本体を削除(これだけだとdatabaseは削除されない)
$ brew uninstall mysql

mysql56をインストールする

$ brew install homebrew/versions/mysql56

mysql56の自動起動設定

$ ln -s /usr/local/opt/mysql56/homebrew.mxcl.mysql56.plist ~/Library/LaunchAgents
$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql56.plist

mysql56を立ち上げる

$ mysql.server start

これでエラーになる場合は、

などのケースがある。

前者については、プロセスを殺していく。

$ ps aux | grep mysql
$ kill -9 <プロセス番号>

後者については、

$ cd /usr/local/var/mysql
$ rm -rf ib_logfile*

うん、Homebrewやっぱり便利!!

1
1
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
1
1