Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MacOSX: autostart mysql on boot

I just installed mysql in terminal through homebrew.

Now when I try to connect to mysql it fails, but after I run mysqld it works..

So what I need to do now is run mysqld when I boot my Mac.

I've searched Google for mysqld autoload at startup etc. but couldn't find the right answer.

Hope someone can point me in the right direction.. Thanks!

like image 890
Tim Baas Avatar asked Nov 04 '11 19:11

Tim Baas


People also ask

Is MySQL installed on Mac by default?

By default, the MySQL directories are installed under /usr/local/ . Even better, add /usr/local/mysql/bin to your PATH environment variable. You can do this by modifying the appropriate startup file for your shell. For more information, see Invoking MySQL Programs.


1 Answers

brew info mysql gives you the instructions for loading MySQL at startup, but here's all you need to do:

mkdir -p ~/Library/LaunchAgents cp `brew --prefix mysql`/*mysql*.plist ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/*mysql*.plist 
like image 59
mipadi Avatar answered Oct 18 '22 01:10

mipadi