LoginSignup
2
4

More than 5 years have passed since last update.

Mac にHomebrew で入れたMySQLの自動起動設定

Last updated at Posted at 2017-09-25

プログラムを起動させる際、MySQLもいちいち起動させなきゃいけない状況←面倒!!

railsを起動時に自動でMySQLを一緒に起動させる

$ cd /usr/local/Cellar
mysql

ここにmysqlが存在することがわかる

$ cp /usr/local/Cellar/mysql/5.7.19/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist 

もしここでMySQLが起動している場合、設定変更によってポートがぶつからないように一度シャットダウンをしておく

$ mysqladmin -uroot shutdown

起動していなければOK

$ launchctl start homebrew.mxcl.mysql

最後に確認!

$ launchctl list | grep mysql
3763    1   homebrew.mxcl.mysql

できた!

2
4
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
2
4