Under the Mac installed MySQL, want to set up the boot from start, originally thought and the General Linux system, is also in RC.D such directory placement startup script. On the Internet to check some information, found that Apple should be completely closed, can only use the Mac system Launchctl to do this thing.
Launchctl in fact is to write a *.plist file, its role and Linux in the role of Crontab is the same. The following code is a com.mysql.plist I wrote:
<! DOCTYPE plist Public "-//apple//dtd plist 1.0//en" "Http://www.apple.com/DTDs/PropertyList-1.0.dtd" >
<plist version= "1.0" >
<dict>
<key>Label</key>
<string>com.mysql</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/bin/mysqld_safe</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<false/>
</dict>
</plist>
1, enter this directory/library/launchdaemons, put the file in this directory
2. Enter this directory in the terminal/library/launchdaemons
Perform
- sudo chown root:wheel com.mysql.plist
Modify this plist file must belong to the root user, wheel group, with Chown modified
3. See if there is a problem with the file format
- sudo plutil-lint ~/com.mysql.plist
4, finally call the LAUNCHCTL command, load this plist,
- Launchctl load-w Com.mysql.plist
If you do not want to start the boot, enter it in the current directory
Launchctl unload-w Com.mysql.plist
Original: http://my.oschina.net/huyuaning/blog/334584
Mac Yosemite 10.10 with launchctl self-booting MySQL