Thesql fails to load on boot

launchdMySQLterminalwine

I have a Macbook. Forever I’ve had mysql server installed and running on start (using El Capitan).

Well now I’ve installed Wine. Since then mysql server fails to start on reboot. If I manually run ./mysqld from /usr/local/mysql/bin
it works fine. Here’s where things go weird: if I use launchctl list then pipe that using grep to see the list of running processes I can’t see the mysql (but I know it's running!)

Terminal window running mysqld:

enter image description here

Terminal window running my grep search to show no mysql processes running [searched for GPG as a control group to show what it should look like when working:

enter image description here

Back when I got the setup running before, I used this: https://stackoverflow.com/a/35445024/2226328 with no problems nor issues. Now since installing wine using: brew install wine I can’t get mysqld to load on start. Any ideas?

Since this I've uninstalled wine and had the same problem, I ran brew update as well but have since determined that I installed mysql separately.

Edit: Some final followup here. Once I ran sudo launchctl list | grep mysql it showed my mysqld running …looking at the system.log for mysql entries showed it was failing to start which led to creating an error log plist entry mentioned in the answer below. changing permissions on the mysql folder recursively fixed the issue. This command will show you the name of your mysql user on the system:
dscacheutil -q user | grep mysql

Best Answer

Depending on where you installed com.oracle.oss.mysql.mysqld.plist you may have to run:

sudo launchctl list | grep mysql

to check if com.oracle.oss.mysql.mysqld.plist is in the launchctl database.

Even if you find it that doesn't necessarily mean that mysql is loaded at start-up. Open Activity Monitor or enter ps | grep mysqld in Terminal.app to check if it is running.


If you get an error like that in your system log:

com.apple.xpc.launchd[1]: (com.oracle.oss.mysql.mysqld) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

unload the plist and add two lines to com.oracle.oss.mysql.mysqld.plist

<key>StandardErrorPath</key>
<string>/tmp/mysql.err</string>

Be sure to properly chmod/chown the file afterwards:

sudo chown root:wheel /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
sudo chmod 644 /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

and reload the launch daemon

sudo launchctl load -w /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

Open the file /tmp/mysql.err in Console and check for further problems.