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 n
I have brew install of MYSQL.
type
brew info mysql
and follow the instructions given:
To have launchd start mysql at login:
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Followup to Alejandro that couldn't fit in a comment.
Check which services are user (login) and root (boot) with this:
$ brew services list
Name Status User Plist
chronograf started jacob /Users/jacob/Library/LaunchAgents/homebrew.mxcl.chronograf.plist
grafana started jacob /Users/jacob/Library/LaunchAgents/homebrew.mxcl.grafana.plist
influxdb started root /Library/LaunchDaemons/homebrew.mxcl.influxdb.plist
kapacitor stopped
mariadb started jacob /Users/jacob/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
memcached started jacob /Users/jacob/Library/LaunchAgents/homebrew.mxcl.memcached.plist
telegraf started jacob /Users/jacob/Library/LaunchAgents/homebrew.mxcl.telegraf.plist
Mipadi's answer failed for me with MySQL 5.6.13 installed with Homebrew on the date of this post. But I checked brew info mysql
as he suggested and it gave me a working solution:
> ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
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
mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/mysql/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
You don't need to setup a plist anymore. The latest version of brew (1.3.4) as of Oct 2017, you can only run:
brew services start <service_name>
and it will auto start every time you restart your computer. The command brew info
gives you this
To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run: mysql.server start