I'm having trouble starting MySQL as a system-wide daemon at startup time. I created a simple .plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.mysql.mysqld</string>
<key>Program</key>
<string>/usr/local/bin/mysqld</string>
</dict>
</plist>
and put it in /Library/LaunchDaemons which according to this article is where system level daemons should be placed. I changed the ownership to root
chown root <path_to_plist>
chgrp admin <path_to_plist>
chmod 644 <path_to_plist>
When I rebooted the daemon did not appear to be running (ps returned nothing, mysql was not able to connect). I was able to start the daemon manually
sudo launchctl load <path_to_plist>
but not automatically.
I eventually moved the .plist to ~/Library/LaunchAgents and after changing the ownership to the logged-in user and rebooting, the daemon finally started.
- Why is mysqld not running under /Library/LaunchDaemons?
- Would running from ~/Library/LaunchAgents create another mysqld instance if another user did the same? (I would like to avoid that)
Thank you!