In the previous article http://www.cnblogs.com/EasonJim/p/6275863.html installed MySQL when installing the installation Steps page of the DMG package, if such installation of MySQL is going to boot from the boot, And in the system setup there is MySQL on the service of the quick interface.
Then if you are installing based on a binary package, if you want to implement boot-up, then you need to use the LAUNCHD for service management.
Implementation steps:
1, in/library/launchdaemons under the new Com.oracle.oss.mysql.mysqld.plist file, the contents are as follows:
<?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 "><plistversion= "1.0"><Dict> <Key>Disabled</Key> <false/> <Key>Exittimeout</Key> <integer>600</integer> <Key>GroupName</Key> <string>_mysql</string> <Key>KeepAlive</Key> <true/> <Key>Label</Key> <string>Com.oracle.oss.mysql.mysqld</string> <Key>Launchonlyonce</Key> <false/> <Key>Processtype</Key> <string>Interactive</string> <Key>Program</Key> <string>/usr/local/mysql/bin/mysqld</string> <Key>Programarguments</Key> <Array> <string>/usr/local/mysql/bin/mysqld</string> <string>--user=_mysql</string> <string>--basedir=/usr/local/mysql</string> <string>--datadir=/usr/local/mysql/data</string> <string>--plugin-dir=/usr/local/mysql/lib/plugin</string> <string>--log-error=/usr/local/mysql/data/mysqld.local.err</string> <string>--pid-file=/usr/local/mysql/data/mysqld.local.pid</string> </Array> <Key>Runatload</Key> <true/> <Key>Sessioncreate</Key> <true/> <Key>UserName</Key> <string>_mysql</string> <Key>WorkingDirectory</Key> <string>/usr/local/mysql</string></Dict></plist>
Tip: To create a file you can use the VI command for these, note to add sudo to the beginning.
2, modify the permissions:
sudo chown root: Wheel com.oracle.oss.mysql.mysqld.plist
3. Check grammar
sudo plutil-lint com.oracle.oss.mysql.mysqld.plist
4. Loading
Tip: This setting is ready to boot.
5, uninstall, cancel boot from boot
Delete com.oracle.oss.mysql.mysqld.plist
Reference:
http://blog.csdn.net/lolashe/article/details/41117577
http://squll369.iteye.com/blog/1965185
http://www.cnblogs.com/EasonJim/p/7173859.html (Basic Service command operation)
HTTPS://EN.WIKIPEDIA.ORG/WIKI/LAUNCHD (plist syntax Reference)
Mac 10.12 Create custom services via LAUNCHD (start-up from MySQL 5.7.15)