Bug #25008 Mac OS X's StartupItem does not work
Submitted: 12 Dec 2006 14:25 Modified: 2 Apr 2008 18:44
Reporter: Frédéric Brussel Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.0.27, 5.0.41 OS:MacOS (Mac OS X 10.4.8)
Assigned to: Kent Boortz CPU Architecture:Any
Tags: automatically, Mac OS X, preference pane, server, start, startup

[12 Dec 2006 14:25] Frédéric Brussel
Description:
In Mac OS X's preferences for MySQL, there's a "Automatically start MySQL Server on startup" checkbox. When this option is checked (activated), the MySQL Server does NOT start automatically after reboot or simply after starting up the computer. You always need to start up the server manually.

How to repeat:
Always
[21 Dec 2006 20:18] Sveta Smirnova
Thank you for the report.

I can not repeat it on Intel Mac.
[22 Mar 2007 14:22] [ name withheld ]
I have this same issue on a MacBook Pro running Tiger 10.4.9.
[31 Mar 2007 9:43] Mark W
I too cannot automatically start the MYSQL server under MAC OSX 10.4.9 (Macbook, Intel core 2 duo).

Did some rummaging around, and I cannot find the MySQLCOM startup item in the /Library/Startupitems. The correct MYSQLCOM=-YES- is in hostconfig.....but I guess if the thing isn't where it should be.......
[11 Apr 2007 10:06] Sveta Smirnova
Thank you for the feedback.

Please upgrade to current 5.0.37 Community or 5.0.38 Enterprise and try again.
[18 Apr 2007 2:08] Albert Madrilejos
I am using an Intel Mac Mini with MySQL version 5.0.37 on Mac OS X 10.4.9.  I am also trying to get automatic startup with MySQL but with no avail.  Has this bug been fixed yet?  The last comment was recommending to update to 5.0.37 but there has been no changes in this being fixed.

Any other recommendations.  Is there a way to manually do this with out the pref pane: an alternative?
[19 Apr 2007 6:30] Mark W
I am still running 5.0.27 under OSX 10.4.9. However, I was not happy about upgrading just to get the autostart to work, since I wanted to keep this version as it is synched (version wise with a couople of other servers). I did however re-install the startup.pkg from the latest release and all is now well.

Yes, you could use a shell script to automatically start MYSQL on boot-up.
[11 May 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[30 Jul 2007 8:15] Andrew Montague
This is still a problem for me with 5.0.41 on Tiger 10.4.10.
[30 Jul 2007 8:35] Sveta Smirnova
Thank you for the feedback.

Please provide output of command `id` running as user you try to start/stop MySQL as. Also provide output of command `cat /var/log/secure.log | grep MySQL`
[31 Jul 2007 6:30] Andrew Montague
Here is the information you were looking for:
iMac:~ andrew$ id
uid=501(andrew) gid=501(andrew) groups=501(andrew), 80(admin)
iMac:~ andrew$ cat /var/log/secure.log | grep MySQL
Jul 30 08:51:13 iMac com.apple.SecurityServer: Succeeded authorizing right com.mysql.administrator.server by process /Library/PreferencePanes/MySQL.prefPane/Contents/Resources/mahelper for authorization created by /Applications/System Preferences.app.
Jul 31 07:22:31 iMac com.apple.SecurityServer: Succeeded authorizing right com.mysql.administrator.server by process /Library/PreferencePanes/MySQL.prefPane/Contents/Resources/mahelper for authorization created by /Applications/System Preferences.app.
[31 Jul 2007 7:18] Sveta Smirnova
Thank you for the feedback.

Please also provide MySQL error log.
[31 Jul 2007 9:19] Andrew Montague
Where do I find the MySQL error logs?
[31 Jul 2007 9:22] Sveta Smirnova
In the data directory. You have to turn it on first as described at http://dev.mysql.com/doc/refman/5.0/en/error-log.html
[31 Jul 2007 9:53] Andrew Montague
The instructions on that page aren't clear to me. They say: "You can specify where mysqld writes the error log with the --log-error[=file_name] option". What command do I use with this option?

Thanks
Andrew
[31 Jul 2007 10:00] Sveta Smirnova
Please read how you can specify startup options at http://dev.mysql.com/doc/refman/5.0/en/server-options.html
[31 Jul 2007 11:31] Andrew Montague
Here's the error log:
070731 12:27:19  mysqld started
070731 12:27:19 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
070731 12:27:19  InnoDB: Started; log sequence number 0 43655
070731 12:27:20 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.0.41'  socket: '/tmp/mysql.sock'  port: 3306  MySQL Community Server (GPL)
[8 Aug 2007 15:56] John Gregory
I too have this problem on 5.0.45
[27 Aug 2007 20:21] Jessica Anderson
I have the same problem. In my system prefs, I hit the start MySQL Server button and it prompted me for my password and it is still saying "stopped." I also restarted since I have the auto startup checked and nothing. 

I then went to terminal and typed in the following and it seemed to start:
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Starting MySQL database server

But when I enter: /usr/local/mysql/bin/mysql
tcsh: /usr/local/mysql/bin/mysql: Bad CPU type in executable.

What am I doing wrong? I am very new to this so please be kind.
[7 Sep 2007 22:53] JCB USA
I ran into a similar issue with MySQL 5.0.45 not starting consistantly (40% of the time it would startup after a reboot) on OS X 10.4.10.  If I manually run the StartupItem (/Library/StartupItems/MySQLCOM/MySQLCOM start) after the machine is running MySQL starts and runs just fine.

The key is the location of the MySQL datadir.  In /etc/my.cnf I specified the following datadir under the [mysqld] heading:
datadir = /Volumes/XRAID/mysql/data (where XRAID is a Fibre Channel XRAID array)

It appears that a PPC XServer does not mount a XRAID fast enough for the mysql data to be accessed by the StartupItem.

A simple solution is to put "sleep 30" in the MySQLCOM StartupItem before it runs $SCRIPT start.

Another solution is to loop until the XRAID is accessible.
while ! [ -e /Volumes/XRAID/mysql/data ] do
   sleep 1
done

Hope this helps those who are running MySQL with a datadir on a external drive.
[8 Nov 2007 21:59] V C
I'm having the same problem.  Preference pane will start and stop the server but will not auto start on reboot even with this option checked.
[2 Feb 2008 18:41] Yves Forget
Just installed 5.0.51a with the package installer.

The mysql package installed correctly, but the mysqlStartupItems tells that it terminated normally, but it did not create anything under /Library/StartupItems.

I'm running OS X 10.5.1 on a intel core 2 duo (Mac Mini 2Ghz)

Yves
[7 Feb 2008 7:54] Jun T.
The MySQLStartupItem.pkg in mysql-5.0.51a-osx10.4-i686.dmg is virtually empty and installs nothing (in /Library/StartupItems/ or wherever else).

$ cd /Volumes/mysql-5.0.51a-osx10.4-i686/MySQLStartupItem.pkg/Contents
$ lsbom Archive.bom
.       40755   0/0
$ pax -z -f Archive.pax.gz 
.
$ cat Resources/MySQLStartupItem.sizes 
NumFiles 0
InstalledSize 0
CompressedSize 0

This may be just a bug, or should we abandon StartupItems and switch to launchd plist?
[7 Feb 2008 9:14] Andrew Lindley
To duplicate my comment to Bug #20124 as it may be relevant.

Installing mysql-5.0.51a.osx10.4-powerpc.dmg on Leopard 10.5.1 I find that the MySQLCOM
directory has been installed under /usr/local not /System/Library/StartupItems or
/Library/StartupItems . Using Terminal to mv the directory under
/System/Library/StartupItems causes MySQL to run on boot as per the prefs pane. However,
the prefs pane cannot start/stop mysql independently of this. Has the .pkg (and possibly
the prefs pane) been built with incorrect file paths in it's configuration?
[7 Feb 2008 10:10] Jun T.
Thank you Andrew,

Yes, mysql-5.0.51a-osx10.4-i686.pkg (NOT MySQLStartupItem.pkg) does install MySQLCOM under /usr/local/. If I move it to /Library/StartupItems/ then everything works as expeced.

Andrew Lindley writes:
>However, the prefs pane cannot start/stop mysql independently of this.

It works in my case.
MacOS 10.4.11, intel iMac
[13 Feb 2008 3:53] Yves Forget
Hi again,

I moved MySQLCOM from /usr/local to /System/Library/StartupItems.

Now MySQL starts automatically.

The Preferences Panel correctly shows the active status, but the "start Mysql" and "stop mysql" don't work.

Yves
[13 Feb 2008 20:58] Andrew Lindley
Yves,

I found this alternate (open source) Preferences Pane which works for me.

http://creativeeyes.at/tools/mysqlpp.php

Andrew (ordinary MySQL user)
[22 Feb 2008 16:45] Sveta Smirnova
Thank you for the report.

Verified as described with version 5.0.51a. To repeat remove prefPane before installing new package.
[7 Mar 2008 7:47] Mattias Jonsson
I have tested a non released mysql-enterprise-gpl-5.0.58-osx10.4-powerpc.dmg package which both includes the working MySQL.prefPane and a working StartupItem.pkg. I will update this bug when I know in which versions it will be released in.

The bug was that the MySQLStartupItem.pkg did not contain the /Library/StartupItems/MySQLCOM (instead it was located as /usr/local/MySQLCOM in the mysql-<server>.pkg)

Until then, the working MySQL.prefPane for Mac OS X 10.5 (Bug#28854) is here:
ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip

and to get the StartupItem to work, copy or move the (if existent) /usr/local/MySQLCOM directory to /Library/StartupItems/MySQLCOM
[7 Mar 2008 8:54] Mattias Jonsson
Marked Bug#35043 as a duplicate of this bug.
[7 Mar 2008 17:37] Kent Boortz
Will be corrected in MySQL 5.0.56 (Mac OS X dmg not released yet),
5.0.58, 4.1.24 and 5.1.24
[9 Mar 2008 14:52] Mattias Jonsson
marked Bug#35172 as a duplicate of this bug.
[14 Mar 2008 18:23] Sveta Smirnova
Bug #35294 was marked as duplicate of this one
[15 Mar 2008 22:12] Mattias Jonsson
Bug#35314 was marked as duplicate of this one.
[16 Mar 2008 0:26] Terry Mahoney
Thank you Matthias. The combination of moving /usr/local/MySQLCOM to /Library/StartupItems and downloading your new MySQL.prefpane has fixed the problem on my G5 (64bit) PPC Leopard (10.5.2) platform.

FYI, I do NOT have this problem on my Tiger-based (10.4.10) Intel Macbook. That download was mysql-standard-5.0.27-osx10.4-i686.pkg, (Contents modified 25-Feb-07, 11:24 PM).

Terry M. (home-based MySQL user)
[16 Mar 2008 0:27] Terry Mahoney
Thank you Mattias. The combination of moving /usr/local/MySQLCOM to /Library/StartupItems and downloading your new MySQL.prefpane has fixed the problem on my G5 (64bit) PPC Leopard (10.5.2) platform.

FYI, I do NOT have this problem on my Tiger-based (10.4.10) Intel Macbook. That download was mysql-standard-5.0.27-osx10.4-i686.pkg, (Contents modified 25-Feb-07, 11:24 PM).

Terry M. (home-based MySQL user)
[20 Mar 2008 2:46] Roupen Nahabedian
Newb Q: How does one access the Preference Panel referenced?

By the way, I am running 10.5.2 Leopard and installed 5.0.51a on Macbook Pro and same issue with StartupItem trying to correct.
[20 Mar 2008 3:38] Roupen Nahabedian
Me again... when I try "mv MySQLCOM/ /Library/StartupItems/" from "/usr/local/MySQLCOM" i get permission denied. I tried to mkdir under /StartupItems same issue.

Fellow Leopard users that have done already - what am i missing? Tried "su" to no avail. HELP! :)
[20 Mar 2008 6:20] Mattias Jonsson
If the MySQLCOM dir is located in /usr/local, then do "sudo mv /usr/local/MySQLCOM /Library/StartupItems/" to move it to the correct place. The link for the updated MySQL.prefPane (from Bug#28854) is, as stated above:
ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip
after it is installed, you can graphically start and stop MySQL through "System Preferences->MySQL".
[20 Mar 2008 7:05] Roupen Nahabedian
Thanks Mattias. One more question -- where do I copy the MySQL.prefPane to? Again, pardon the newb question :)
[20 Mar 2008 7:53] Mattias Jonsson
Regarding the MySQL.prefPane, it should be as easy as a double click. (Mac OS X installs it into the System Preferences then. Either /Users/<user>/Library/PreferencePanes/MySQL.prefPane if you install it for a specific user or /Library/PreferencePanes/MySQL.prefPane if you install for everyone.)
[20 Mar 2008 18:45] Roupen Nahabedian
Mattias, life is good bro :) Thanks! 

The mv worked and the StartupItem is in System Prefs and I am able to start and stop MySQL. Sweet!

Final Q: Does the option to "Automatically Start MySQL at Startup" work with this workaround?
[2 Apr 2008 12:32] Kent Boortz
Was corrected in 4.1.24, 5.0.56, 5.1.24-rc
[2 Apr 2008 18:44] Paul DuBois
Noted in 4.1.24, 5.0.60, 5.1.24 changelogs.

On Mac OS X, the StartupItem for MySQL did not work.
[8 Apr 2008 10:42] Sveta Smirnova
Bug #35892 was marked as duplicate of this one.
[8 Apr 2008 12:36] Dirk H. Schulz
Sveta, 

this bug is NOT a duplicate of #35892. Here, people have difficulties with starting up MySQL Server on MacOS X for various reasons although a startup item IS installed. 

I have verified that the MySQLStartupItem.pkg of mysql-5.0.51a for MacOS X 10.4 PowerPC DOES NOT INSTALL any startup item because the package DOES NOT CONTAIN the startup item to be installed. 

But no problem, we can run this as part of bug #25008 if that makes things easier. 

Again the way to verifiy the bug: 
If you take for example MySQLStartupItem.pkg from mysql-5.0.45-osx10.4-powerpc.dmg, open it and go to
/Volumes/mysql-5.0.45-osx10.4-powerpc/MySQLStartupItems.pkg/Contents and do "gzip -cd Archive.pax.gz", you get
.
./MySQLCOM
./MySQLCOM/MySQLCOM
./MySQLCOM/StartupParameters.plist

That means: There IS a startup item to install within the pkg file. 

If you do the same with the current version 5.0.51a, you get:
.
And that is the problem I opened the bug for - NO startup item to install within the pkg file. The archive is empty, and the BOM is empty as well. 

Regards, 

Dirk
[8 Apr 2008 12:41] Dirk H. Schulz
Sveta, 

I am sorry, I now found that somewhere amongst all the different problems mentioned here there is also what I described. Sorry for doubling up. 

Dirk
[8 Apr 2008 23:58] Sveta Smirnova
Bug #35915 was marked as duplicate of this one.
[29 Apr 2008 22:56] Paul DuBois
Noted in 5.0.51b changelog.
[3 May 2008 22:01] Ben Robinson
Try auto-starting MySQL server as root.

Instructions:
1. If you don't already have a root account, create one: <code>sudo passwd root</code>
2. Continuing from step 1, enter and confirm a password for root.  Now log out and log in using username "root" and password = the password you just set.
3. Go to your preferences pane in the root account and, assuming you chose to have a MySQL preferences pane installed, select "Automatically start MySQL Server on startup."
[13 Apr 2009 18:13] Ruud Reus
User 'mysql' has to be the owner of the data directory.

try:

sudo chown -R mysql /usr/local/mysql/data