Bug #28854 MySQL.prefPane does not start or stop mysql on osx 10.5
Submitted: 3 Jun 2007 6:19 Modified: 20 Mar 2008 20:41
Reporter: Dave Seybold
Status: Closed
Category:Server: Installing Severity:S1 (Critical)
Version:5.0.41 OS:Mac OS X (10.5)
Assigned to: Mattias Jonsson Target Version:5.0+
Tags: prefpane, leopard
Triage: D2 (Serious)

[3 Jun 2007 6:19] Dave Seybold
Description:
error msg:
launchd[1] System: com.apple.SystemStarter: Standard out/error: Starting MySQL database
server

starting mysql on 10.5 is not possible.

How to repeat:
just install the osx10.4 package and try to start mysql server.
[4 Jun 2007 12:29] Sveta Smirnova
Thank you for the report.

But Mac OS X 10.5 is not released yet. We will return to the report after Mac OS X 10.5
will be released.
[27 Sep 2007 3:37] Michael Burton
Has anyone come up with a workaround for this bug yet?  I see no activity on this bug or
on Bug #29301
[26 Oct 2007 20:20] Michael Burton
Leopard is in customer's hands already if they ordered from Amazon or Apple's online
store.  Does anyone at MySQL have any insight into how to run MySQL on Leopard before I
go and try to tackle this?

Cheers
[26 Oct 2007 21:18] Jim Winstead
Re-opening this bug now that Leopard has been released. (Were we really too cheap to
spring the $500 for a developer to join the Apple developer program and get access to the
pre-release developer seeds?)
[26 Oct 2007 23:30] Stan Lemon
I just successfully started mysql up on 10.5.  The 5.0.45 installer works fine, I was able
to use the client and connect without any problems.  I did have issues with PHP on 10.5,
but this was reconciled by altering php.ini to go directly to /private/tmp/mysql.sock
instead of where it defaults to at /tmp/mysql.sock  Note, if you want the mysqli
extension to work, you'll need to specify the socket file just the same.

Pax.
[27 Oct 2007 3:03] Sean Stickle
Installation of 5.0.45 worked fine. Server, Startup, and Preference Pane all.

I could not start up the server using the Preference Pane, however. I had to run
"/Library/StartupItems/MySQLCOM/MySQLCOM start" manually. Then I could connect with the
CLI client without any problems.

Once started, I could not stop the server using the Preference Pane either. However,
stopping it from the CLI with "/Library/StartupItems/MySQLCOM/MySQLCOM stop" worked
fine.

In short, I can get the server to start and stop. But the Preference Pane, it does
nothing.
[27 Oct 2007 13:19] Kenny Lövrin
I have/had the same problem.. 

Running a chmod -R 777 on the whole mysql folder helps though.. so the problems seems to
be with some permissions.. running this probably isn't recommended though for production
environments.. :)

but for me, who wanted to try out ruby on rails, it is not a very big issue..
[29 Oct 2007 18:34] Mark Wade
As previously posted, preferences pane is broken with 10.5.
mysql starts okay using mysqld_safe& however. havn't tried stopping it yet...

mysql  Ver 14.12 Distrib 5.0.41, for apple-darwin8.6.0 (powerpc) using readline 5.0
[31 Oct 2007 20:24] Richard Valk
I think it also has to do with the fact that the mysql user has an underscore in front of
the user name in Leopard (don't know why!) change the username in mysql.server and it
will start properly after a reboot with the correct username as used in the setup.

Preference pane still doesn't work
[31 Oct 2007 20:42] Richard Valk
I think you need to make a slight adjustment to one file called 'mysql.server' in the
directory '/usr/local/mysql/support-files/'. On line 62 change:
user=mysql
into:
user=_mysql
[1 Nov 2007 4:00] Mark Wade
oh,
prefernces pane doesn't work because:

/usr/local/mysql/bin/mysqld: Can't create/write to file
'/var/folders/w3/w37wtiElECCtRBWy7MqtpU+++TI/-Tmp-/ibOGkulV' (Errcode: 13)
071029 14:28:39  InnoDB: Error: unable to create temporary file; errno: 13

don't know if it's a good thing but the following fixes it:

cd /var
chmod -R a+w folders

preferences pane will then start and stop mysql server.
[1 Nov 2007 5:11] Mark Wade
sorry, i was wrong. worked once but not after a restart, don't know why :(
[8 Nov 2007 3:30] Donald Tyler
5.0.45 works fine on 10.5, but the preferences pane doesn't work.

There is no need to change the username from mysql to _mysql in the mysql.server file
because both usernames are valid and both are actually the same user.

The previous comments about having to reconfigure PHP to point to the MySQL socket in
/tmp/mysql.sock are still valid.
[8 Nov 2007 3:36] Donald Tyler
Apologies for the double post.

Just wanted to correct an error in a previous post about the mysql.sock file. The
directory "/private/tmp/" and "/tmp/" are the same directory; "/tmp/" is a link to
"/private/tmp/".

Contrary to the previous post, the default default location that PHP looks for the
mysql.sock file is *not* "/tmp/mysql.sock", it's actually "/var/mysql/", which is
incorrect in OSX 10.5.

So when pointing your php.ini to the mysql.sock location, just use "/tmp/mysql.sock".
[13 Nov 2007 10:07] Sveta Smirnova
Bug #32019 was marked as duplicate of this one.
[26 Nov 2007 23:00] Brandon Zylstra
Leopard has been out for a month, and MySQL AB could care less that MySQL won't run on it.
 They have done nothing to fix this bug.  

There are several workarounds posted on the web, but not all of them work.   It is up to
users to fiddle with lots of different things and do their own troubleshooting.   This
leaves a really bad taste in my mouth for MySQL.
[27 Nov 2007 8:52] Sven S.
I fully agree there and hope that considering these facts many developers give sqlite3 and
PostgreSQL a serious thought instead of just mindlessly go with the MySQL flow.
[27 Nov 2007 10:08] Daniel Fischer
The startup item and the preference pane are not yet supported on Mac OS X 10.5. The MySQL
server itself and the command line client included in the OS X 10.4 package will work on
OS X 10.5. Please refer to the MySQL manual section on installing MySQL on Mac OS X for
instructions for starting the MySQL server from the command line without using the
startup item:

http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html

No other changes are necessary to start the server in this way on OS X 10.5, including
any changes to settings regarding the user name, or to permissions.
[27 Nov 2007 19:00] Michael Burton
I probably should have posted my positive experience earlier, but I've been running
without the startup item and preference pane (as suggested by the previous comment) since
a few days after Leopard was released and it's been running very smoothly.
[27 Nov 2007 19:04] Richard Roberts
I have found that it's only the pref pane that doesn't work in Leopard. You can set the
server to auto start using the MySQL Administrator Tool.  

It's slightly annoying, but no show stopper.  

It would be nice to see a proper Leopard release of the tools though.
[4 Dec 2007 17:44] Robert Sesek
I have a workaround for the issue with the "Can’t create/write to file
‘/var/folders/2F/2FtguLeuG1ibx1X9tbDS0E+++TI/-Tmp-/ibYWBjEU’ (Errcode: 13)" error.

To work around this, create a directory in your MySQL root called "tmp" or something,
make sure the server has permissions to write to it. Then open up your my.cnf and put
this in it:

tmpdir=/usr/local/mysql/tmp

For a more tutorial-friendly description to how to do this, see my blog post:
http://www.bluestatic.org/blog/2007/12/04/mysql-in-leopard/
[7 Dec 2007 21:19] John Lloyd
After some fits and starts, I now appear to have mysql and php functioning properly under
OS 10.5.1 (Mac "Leopard"). I had to complete both 

(a) the step mentioned 31 Oct 20:42 by Richard Valk, modding mysql-server [line 62] so
that _mysql is the user (note underscore, which 10.5 apparently sets the mysql user to)
and
(b) the step mentioned 8 Nov 3:36 by Donald Tyler, modding /private/etc/php.ini [line
720] so that mysql.default_socket = [blank]  became mysql.default_socket =
/private/tmp/mysql.sock.

There probably are other ways around some of these issues. For example, I suspect that
one could edit the database of users rename _mysql to be mysql. Also, I guess one could
put a sym link in the place that PHP is looking for the mysql.sock. 

I hope the path I've taken is the most sensible. *Sigh*
[14 Jan 2008 19:41] Josh Bourquin
I was able to get the preference pane to start and stop mysql 5.0.45 on Leopard 10.5.1 by
changing the ownership of the mysql data folder.  Here is the terminal command I used:

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

Be sure to replace 'user' in the command with your user name and then you should be able
to start and stop the server through the preference pane.
[14 Feb 2008 1:39] Alfredo Kojima
A fixed version of the MySQL prefpane has been uploaded to:

ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip

In addition, it will be shipped with the next releases of the MySQL server for OSX.
[14 Feb 2008 1:44] Alfredo Kojima
An additional note:

It seems inability to start the server in Leopard could be caused by 2 reasons, one was
an incompatibility
of the prefpane with Leopard, which has been resolved in the above mentioned binary.
The other is incorrect permissions of the MySQL data directory, as commented by someone
else in this bug. The fixed prefpane will try to detect that problem and show a warning,
but it's still up to the user
to properly address it (chown -R mysql:wheel /usr/local/mysql/data)
[18 Feb 2008 16:16] Mattias Jonsson
Documentation notes:
MySQL.prefPane request admin rights and forwards those internally to a binary called
mahelper (same as mysql-administrator uses) that executes as root and calls the
/usr/local/mysql/support-files/mysql.server script to start and stop the server.

MySQL.prefPane uses "/usr/local/mysql/bin/mysqladmin ping" for checking if the server is
up or not.

It alters the file /etc/hostconfig for enable / disable the automatic startup. It
debug-logs through syslog (LOG_DEBUG level).
At start, it checks that the owner of the datadir (tries to get it from /etc/my.cnf or
uses default '/usr/local/mysql/data') is mysql/_mysql, if not, it issues a warning.

The code for MySQL.prefPane is included in mysql-administrator (located in
mysql-administrator/source/mac/PreferencePane, and shares the
mysql-administrator/source/mac/mahelper files with mysql-administrator)
[27 Feb 2008 19:41] Sveta Smirnova
Bug #34814 was marked as duplicate of this one.
[5 Mar 2008 19:35] Sveta Smirnova
Bug #35070 was marked as duplicate of this one.
[7 Mar 2008 8:49] 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.

Until then, the working MySQL.prefPane is here:
ftp://ftp.mysql.com/pub/mysql/download/gui-tools/MySQL.prefPane-leopardfix.zip

and to get the StartupItem to work (see bug#25008), copy the (if existent)
/usr/local/MySQLCOM directory to /Library/StartupItems/MySQLCOM
[10 Mar 2008 17:16] Mattias Jonsson
From bug#25008 (which is about MySQLStartupItem, and the new packages will also include
the updated MySQL.prefPane):

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
[14 Mar 2008 19:25] Sveta Smirnova
Bug #35294 was marked as duplicate of this one
[14 Mar 2008 23:48] Sveta Smirnova
Bug #35110 was marked as duplicate of this one.
[17 Mar 2008 14:51] Sveta Smirnova
Bug #35326 was marked as duplicate of this one.
[20 Mar 2008 20:41] Paul DuBois
Noted in 4.1.24, 5.0.58, 5.1.24 changelogs.

The MySQL preferences pane did not work to start or stop MySQL on Mac
OS X 10.5 (Leopard).
[30 Apr 2008 0:56] Paul DuBois
Noted in 5.0.51b changelog.
[13 Aug 21:09] Terry Mahoney
As of 13Jun2009, the download for mysql-5.1.36-osx10.5-x86_64.dmg MySQL prefpane still
did/does not work.

One fix that did work, for me, was to (use TextWrangler to) append the line
MYSQL=-YES-
to the file
/private/etc/hostconfig

This "fix" was posted by Doug Alexander on the MySQL Forums back in 2004 ...
http://forums.mysql.com/read.php?11,1134,1180

Subsequently, I rebooted my Mac OS X (10.5.7) opened the MySQL prefpane and checked the
checkbox to Activate MySQL on Startup, and then rebooted a second time. After that, the
MySQL status was "Running"

There is a comment in my copy of /private/etc/hostconfig that says "# This file is going
away". :-/

Current configuration: Mac mini (summer 2009 vintage), Apache/2.2.11 (Unix),
mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 PHP/5.2.9, MySQL client version: 5.0.77, PHP
extension: mysql, Server: Localhost via UNIX socket.
Server version: 5.1.36, Protocol version: 10