Bug #28854 MySQL.prefPane does not start or stop mysql on osx 10.5
Submitted: 3 Jun 2007 4:19 Modified: 20 Mar 2008 19:41
Reporter: Dave Seybold Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:5.0.41 OS:MacOS (10.5)
Assigned to: Mattias Jonsson CPU Architecture:Any
Tags: leopard, prefpane

[3 Jun 2007 4: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 10: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 1: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 18: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 19: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 21: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 1: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 11: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 17: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 19: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 19: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 3: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 4:11] Mark Wade
sorry, i was wrong. worked once but not after a restart, don't know why :(
[8 Nov 2007 2: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 2: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 9:07] Sveta Smirnova
Bug #32019 was marked as duplicate of this one.
[26 Nov 2007 22: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 7: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 9: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 18: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 18: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 16: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 20: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 18: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 0: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 0: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 15: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 18:41] Sveta Smirnova
Bug #34814 was marked as duplicate of this one.
[5 Mar 2008 18:35] Sveta Smirnova
Bug #35070 was marked as duplicate of this one.
[7 Mar 2008 7: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 16: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 18:25] Sveta Smirnova
Bug #35294 was marked as duplicate of this one
[14 Mar 2008 22:48] Sveta Smirnova
Bug #35110 was marked as duplicate of this one.
[17 Mar 2008 13:51] Sveta Smirnova
Bug #35326 was marked as duplicate of this one.
[20 Mar 2008 19: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).
[29 Apr 2008 22:56] Paul DuBois
Noted in 5.0.51b changelog.
[13 Aug 2009 19: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
[6 Oct 2010 8:27] Karl-Arne Gjersyen
Hello.
I have downloaded and installed mysql-5.5.6-rc-osx-10.6-x86_64.DMG but can´t start it. 
Here is data from my Mac
Modellnavn:	MacBook Pro
  Modellidentifikator:	MacBookPro6,2
  Prosessornavn:	Intel Core i5
  Prosessorhastighet:	2,4 GHz
  Antall prosessorer:	1
  Antall kjerner totalt:	2
  Nivå 2-buffer (per kjerne):	256 kB
  Nivå 3-buffer:	3 MB
  Hukommelse:	4 GB
  Koblingshastighet for prosessor:	4.8 GT/s
  Start-ROM-versjon:	MBP61.0057.B0C
  SMC-versjon (system):	1.58f16
  Serienummer (system):	W80371W1AGX
  Maskinvare-UUID:	B75C031F-B23A-5AA4-B9D7-187AAF2045F4
  Sudden Motion Sensor:
  Tilstand:	Aktivert

Location:
Karl-Arne-Gjersyens-MacBook-Pro:~ karl$ ls -l /usr/local/mysql
lrwxr-xr-x  1 root  wheel  29 Oct  6 10:12 /usr/local/mysql -> mysql-5.5.6-rc-osx10.6-x86_64
Karl-Arne-Gjersyens-MacBook-Pro:~ karl$ 

Karl-Arne-Gjersyens-MacBook-Pro:~ karl$ cd /usr/local/mysql
Karl-Arne-Gjersyens-MacBook-Pro:mysql karl$ pwd
/usr/local/mysql
Karl-Arne-Gjersyens-MacBook-Pro:mysql karl$ ls -l
total 296
-rw-r--r--   1 root    wheel   17987 Sep 13 12:25 COPYING
-rw-r--r--   1 root    wheel    5139 Sep 13 12:25 EXCEPTIONS-CLIENT
-rw-r--r--   1 root    wheel    9205 Sep 13 12:25 INSTALL-BINARY
-rw-r--r--   1 root    wheel  110034 Sep 13 12:25 README
drwxr-xr-x  44 _mysql  wheel    1496 Oct  6 10:13 bin
drwxr-xr-x   5 _mysql  wheel     170 Oct  6 09:01 data
drwxr-xr-x   4 root    wheel     136 Oct  6 10:13 docs
drwxr-xr-x  42 root    wheel    1428 Oct  6 10:13 include
drwxr-xr-x  12 root    wheel     408 Oct  6 10:13 lib
drwxr-xr-x   4 root    wheel     136 Sep 13 13:42 man
drwxr-xr-x  19 root    wheel     646 Oct  6 10:13 mysql-test
drwxr-xr-x   3 root    wheel     102 Oct  6 10:13 scripts
drwxr-xr-x  32 root    wheel    1088 Oct  6 10:13 share
drwxr-xr-x  28 root    wheel     952 Oct  6 10:13 sql-bench
drwxr-xr-x  16 root    wheel     544 Oct  6 10:13 support-files
Karl-Arne-Gjersyens-MacBook-Pro:mysql karl$ 

Karl-Arne-Gjersyens-MacBook-Pro:mysql karl$ ls -l /Library/StartupItems/
total 0
drwxr-xr-x  4 root  staff  136 Oct  6 10:13 MySQLCOM
Karl-Arne-Gjersyens-MacBook-Pro:mysql karl$ 

Karl-Arne-Gjersyens-MacBook-Pro:mysql karl$ ls -l /Library/StartupItems/MySQLCOM/
total 16
-rwxr-xr-x  1 root  staff  1300 Sep 13 13:42 MySQLCOM
-rw-r--r--  1 root  staff   472 Sep 13 13:42 StartupParameters.plist
Karl-Arne-Gjersyens-MacBook-Pro:mysql karl$ 
----------------------------------------------------------------------
My MacBook Pro is running Snow Leopard. It is a 2.4GHz box with 4GB SDRAM and 320GB HDD.

I don´t receive any error message eiter, so I don´t know what´s going wrong.
Hope some of you can give me a hint for what I need to do.

Thank you very much!
Kind Regards,
Karl-Arne
[5 Jan 2011 6:28] BuB Javier
I downloaded mysql-5.5.8-osx10.6-x86_64.dmg and installed it on my Snow Leopard (10.6.5) 64-bit MBP.

Issues:
1. I wasn't able to start mysql service using the pref pane nor manually starting up using `sudo /Library/StartupItems/MySQLCOM/MySQLCOM start` via command line.
2. The preference pane seems to be not responding or not working when "Start.." button is clicked.

Solution:
1. [31 Oct 2007 20:42] Richard Valk's solution to change value of user to "_mysql" on ./support-files/mysql.server
2. Pref pane seems to be just running ./support-files/mysql.server bash script, and found out that it uses `pidof` command for getting the process id of mysqld service, and realized that my OSX doesn't have the `pidof` command so it fails on that. Also, some mysql bin files are required on such bash script cannot be located properly, so I manually update the value of basedir and datadir:

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

though I cant find binary for `pidof` command so I created my own /bin/pidof file based on Benjamin Han's pidof http://www.cs.cmu.edu/~benhdj/Mac/unix.html

dont forget to chmod +x /bin/pidof.
[5 Mar 2011 5:15] Lance Quejada
go to 'usr/local/mysql' and run this 'sudo chown -R _mysql:wheel data'