Skip to content

Instantly share code, notes, and snippets.

@subfuzion
Created March 18, 2014 22:39
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save subfuzion/9631368 to your computer and use it in GitHub Desktop.
Save subfuzion/9631368 to your computer and use it in GitHub Desktop.
mysql auto start on OS X

Install with Homebrew

brew install mysql

Set up launchctl to auto start mysql

$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

/usr/local/opt/mysql/ is a symlink to /usr/local/Cellar/mysql/x.y.z (e.g., 5.6.16)

You can use launchctl to start and stop mysql

$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

You can also more conveniently use brew to start, stop, and verify service status

$ brew services list | grep mysql
$ brew services start mysql
$ brew services stop mysql

Notes

The mysql configuration is stored at /usr/local/opt/mysql/my.conf.

For more about launchctl see:

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/launchctl.1.html#//apple_ref/doc/man/1/launchctl

http://launchd.info/

@cAstraea
Copy link

yea the brew services start / stop does nothing for me ... can only start with mysql.server start and stop ... think will need to nuke this mac os sierra and reinstall everything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment