Bug #59855 Use launchd daemon instead of deprecated startup item for MySQL on MacOSX
Submitted: 31 Jan 2011 21:37 Modified: 8 Dec 2016 17:06
Reporter: Sierk Bornemann Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:5.x.x OS:MacOS (10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10)
Assigned to: CPU Architecture:Any
Tags: deprecated, launchd daemon, startup item

[31 Jan 2011 21:37] Sierk Bornemann
Description:
MySQL on MacOSX uses Startup Items (/Library/StartupItems/) for starting the MySQL server and places the files /Library/StartupItems/MySQLCOM/MySQLCOM and /Library/StartupItems/MySQLCOM/StartupParameters.plist into that directory.

Startup Items are deprecated since MacOSX 10.4 (and only recommended/allowed for legacy use) in favor of launchd daemons -- even more on MacOSX 10.5 and 10.6.

See:

Apple Developer: MacOSX Reference Library: Technical Note TN2083: Daemons and Agents
http://developer.apple.com/library/mac/#technotes/tn2005/tn2083.html

Section "Old Systems and Technology" -> Deprecated Daemonomicon
http://developer.apple.com/library/mac/#technotes/tn2005/tn2083.html#SECOLDDAEMONOMICON

How to repeat:
Install the MySQL pkg from Sun/Oracle on MacOSX.

Suggested fix:
Don't use a startup item placed in the (deprecated) directory /Library/StartupItems/.

Instead, use a launchd daemon with a Property List placed in /Library/LaunchDaemons/).

See:

Section "Daemons"
http://developer.apple.com/library/mac/#technotes/tn2005/tn2083.html#SECDAEMONS

Apple Developer: MacOSX Reference Library: System Startup Programming Topics
http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/index.html

Note:
Beyond that, MySQL installs its (long time deprecated) StartupItem with false permissions into the (deprecated place) /Library/StartupItems/, so that it could not executed per default by the system because of security concerns, what produces an error message instead.

See also:

Bug #57099 False permissions of MySQL StartupItem on MacOSX prevent launchd to start MySQL
http://bugs.mysql.com/bug.php?id=57099
[21 Feb 2011 15:42] Rob Lewis
With major changes apparently coming for Mac OS X 10.7, this relatively simple fix should be given priority.
[22 Aug 2011 18:59] Sierk Bornemann
Any progress in this issue?
[24 Oct 2011 11:26] Sierk Bornemann
Any news on this issue?
Why still NO assignee?
Any patch available?
Can I help to work on it and close this issue finally?
[18 Dec 2011 19:30] Sierk Bornemann
Since Version of this bug is targeted to 5.6+, and 5.6 already is underway and has reached 5.6.4_m7 (and this bug still isn't fixed) at time of this writing, I politely and remindfully ask:

Any progress in this issue? Any estimated time of being fixed in the foreseeable future?
[15 Apr 2012 13:10] Sierk Bornemann
Any progress in this issue?
Any more specific ETA?
_Which_ 5.6+ (since version 5.6 nears itself to the first GA, Target Version 5.6+ is a little bit too unspecific pinned into the future and could mean everything or nothing at all, isn't it?)
Come on guys, does ist take soooo long for such a relative simply but architectural not unimportant fix to be more conform and up-to-date to MacOSX' platform and file system architecture, which is launchd-based since a _very_ while?
[15 Apr 2012 14:14] Rob Lewis
The silence is deafening…

Apple is the largest computer company in the world. And yet you can't find time to correctly support their systems? Remarkable. 

If you ever DO fix this, please make sure that the new installer removes the deprecated startup items (if any) from previous MySQL installations while installing the new ones.
[14 Oct 2013 15:07] Sierk Bornemann
Since Virtualbox bug #8940 (https://www.virtualbox.org/ticket/8940) has been (finally!) fixed in SVN today (10/14/2013) after being open for 2 years (!) and hopefully finally fixed soon in the next release (see https://www.virtualbox.org/ticket/8940#comment:9), please fix the same issue concerning MySQL (MySQL bug #59855) as soon as possible. The official release of OSX 10.9 (Mavericks) is just a couple of days away, for problems which might occur when not changing the MySQL installation on OSX, have Comment 4 https://www.virtualbox.org/ticket/8940#comment:4 and Comment 7 https://www.virtualbox.org/ticket/8940#comment:7 of the relating Virtualbox bug #8940 in mind.
[11 Jun 2014 14:54] Sierk Bornemann
Any progress? If not, why not?
[7 Oct 2014 19:15] Morgan Tocker
MySQL 5.6.21 installation fails on Mac OS X 10.10 (in Beta).  I will attach the installation log.

As a workaround, it is possible to install by selecting "Customize" and removing the startup item option.
[7 Oct 2014 19:15] Morgan Tocker
Yosemite Install Log

Attachment: yosemite-install-failed-log.txt (text/plain), 21.19 KiB.

[22 Oct 2014 14:19] Sierk Bornemann
Launchd file. To be placed into /Library/LaunchDaemons

Attachment: com.mysql.mysqld.plist (application/octet-stream, text), 341 bytes.

[22 Oct 2014 14:23] Sierk Bornemann
Added plist file for launchd.
Added 10.10 to OS list.
Changed Severity to S1 (Critical).
[3 Nov 2014 4:05] Don Montalvo
Don't forget to set owner:group and permissions:

sudo chown root:wheel /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysqld.plist

As per Apple technote:

https://developer.apple.com/library/mac/technotes/tn2083/_index.html

"Apple recommends that daemons be owned by root, have an owning group of wheel, and use permissions 755 (rwxr-xr-x) for executables and directories, and 644 (rw-r--r--) for files."
[6 Jan 2015 18:38] Philip Olson
In the meantime, launchd related information was added to the documentation:

  * http://dev.mysql.com/doc/en/macosx-installation-launchd.html

And the startup item documentation now refers to it:

  * http://dev.mysql.com/doc/en/macosx-installation-startupitem.html

Additional work will be done after the following bug is resolved:

  DMG file does not include the MySQLStartupitem and prefPane files
  * http://bugs.mysql.com/bug.php?id=74123

Thank you for the helpful information.
[7 Dec 2016 20:55] Yngve Svendsen
Posted by developer:
 
Modernized MySQL 5.6/5.7/8.0 packaging for Mac OS X now uses Launchd
[8 Dec 2016 17:06] Philip Olson
Posted by developer:
 
The source (macOS packages) and related documentation is fixed and updated, setting status to closed. Thank you for the bug report!
[8 Dec 2016 21:49] Don Montalvo
I wear an XXL t-shirt. :)

#ducking

Kudos to everyone for making this happen!