Automatically Start MySQL Server on OS X Yosemite

MySQL can't start automatically on starts up in OS X Yosemite.

Automatically Start MySQL Server on OS X Yosemite

Create /Library/LaunchDaemons/com.mysql.mysql.plist and save it with the following 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>ProgramArguments</key>
        <array>
            <string>/usr/local/mysql/bin/mysqld_safe</string>
            <string>--user=mysql</string>
        </array>
    </dict>
</plist>

Then changed the permissions and load following launchd scripts:

$ sudo chown root:wheel /Library/LaunchDaemons/com.mysql.mysql.plist 
$ sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysql.plist 
$ sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysql.plist

That's it.

0.00 avg. rating (0% score) - 0 votes