I've installed MariaDB on a fresh macOS 10.11 server setup using HomeBrew. The server runs great when I start it manually, but I have been unable to get it to start automatically at boot (not login).
I used sudo brew services start mariadb
to create a launchd script in /Library/LaunchDaemons but it doesn't work. No running mariadb, no mariadb error log. It seems to silently fail. There must be some relevant log somewhere but I don't know where.
When that didn't work, I tried making my own launchd script, first having it run mysql.server start
, but that failed. With full path and proper permissions, but it would never work.
Then I copied some of the code from the homebrew's own launchd plist and made my own plist that runs mysqld_safe, which also doesn't work:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE truncated for easier forum viewing>
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.macfixer.mariadb</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/opt/mariadb/bin/mysqld_safe</string>
<string>--datadir=/usr/local/var/mysql</string>
</array>
<key>WorkingDirectory</key>
<string>/usr/local/var</string>
<key>Disabled</key>
<false/>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/logs/mariadb.out.log</string>
<key>StandardErrorPath</key>
<string>/logs/mariadb.error.log</string>
</dict>
</plist>
The above leaves no trace in the mariadb error log, or the StandardErrorPath error log. However it does leave some content in the StandardOutPath log. And it looks like mariadb is starting up, it just.... isn't.
180326 08:37:27 mysqld_safe Logging to '/usr/local/var/log/mysqld-error.log'.
180326 08:37:28 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
But again, if I run mysql.server start
once the computer boots and logs in, MariaDB starts right up no problem at all. But when started from launchd, it seems to just silently quit immediately.
PATH
environment variable is probably different between your terminal and launchd.StandardErrorPath
to your plist?brew ls -verbose mariadb
to find out where its config and error files might be hiding.