2011. augusztus 9., kedd

Upgrading Mac OS X Snow Leo to Lion and getting Zend Server working again

After Snow Leo to Lion upgrade, mysqld from my Zend Community server stopped working. It wouldn't start logging things like:
half-apple:bin root# ./mysql.server start

Starting MySQL
. ERROR! Manager of pid-file quit without updating file.

or
half-apple:bin janedow$ sudo ./zendctl.sh start-mysql

Starting MySQL
. ERROR! Manager of pid-file quit without updating file.


Logs are in /usr/local/zend/mysql/data/machine-name.err

Messages that showed up:
110809 11:28:51 [ERROR] Fatal error: Can't change to run as user 'zend' ; Please check that the user exists!
110809 11:28:51 [ERROR] Aborting


Obviously the zend user created by the installer has been deleted during the upgrade.

So I recreated the unix user via dscl commands:
half-apple:~ root# dscl localhost -create /Local/Default/Users/zend
half-apple:~ root# dscl localhost -create /Local/Default/Users/zend UserShell /bin/bash
half-apple:~ root# dscl localhost -create /Local/Default/Users/zend RealName "Zend user"
half-apple:~ root# dscl localhost -create /Local/Default/Users/zend UniqueID 600
half-apple:~ root# dscl localhost -create /Local/Default/Users/zend PrimaryGroupID 1000


[Inspired from here, modified to run on Lion to not give invalid datasource error: http://osxdaily.com/2007/10/29/how-to-add-a-user-from-the-os-x-command-line-works-with-leopard/ ]

On next start attempt, I got errors related to mysql access rights:
110809 12:32:33 [Note] Plugin 'FEDERATED' is disabled.

^G/usr/local/zend/mysql/bin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110809 12:32:33 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110809 12:32:33 InnoDB: Initializing buffer pool, size = 8.0M
110809 12:32:33 InnoDB: Completed initialization of buffer pool
110809 12:32:33 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.
110809 12:32:33 mysqld_safe mysqld from pid file /usr/local/zend/mysql/data/half-apple.home.pid ended


I found this post: http://www.worldgoneweb.com/2011/zend-server-community-edition-for-mac-os-x-%E2%80%93-mysql-permissions/ about Zend mysqld persmission problems.

I chowned data and tmp to the newly created zend user:
half-apple:mysql root# ls -la

total 0
drwxr-xr-x 8 root wheel 272 Mar 12 19:33 .
drwxr-xr-x 15 root wheel 510 Aug 6 08:39 ..
drwxr-xr-x 49 root wheel 1666 Mar 8 15:28 bin
drwxr-x--- 16 103 wheel 544 Aug 9 12:34 data
drwxr-xr-x 23 root wheel 782 Mar 12 19:34 lib
drwxr-xr-x 3 root wheel 102 Mar 8 15:28 scripts
drwxr-xr-x 13 root wheel 442 Mar 8 15:28 share
drwxr-xr-x 2 103 wheel 68 Aug 6 08:24 tmp
half-apple:mysql root# chown -R zend data/
half-apple:mysql root# chown -R zend tmp/
half-apple:mysql root# ls -la
total 0
drwxr-xr-x 8 root wheel 272 Mar 12 19:33 .
drwxr-xr-x 15 root wheel 510 Aug 6 08:39 ..
drwxr-xr-x 49 root wheel 1666 Mar 8 15:28 bin
drwxr-x--- 16 zend wheel 544 Aug 9 12:34 data
drwxr-xr-x 23 root wheel 782 Mar 12 19:34 lib
drwxr-xr-x 3 root wheel 102 Mar 8 15:28 scripts
drwxr-xr-x 13 root wheel 442 Mar 8 15:28 share
drwxr-xr-x 2 zend wheel 68 Aug 6 08:24 tmp

After that, mysqld starts up just fine:
half-apple:bin root# ./mysql.server start

Starting MySQL
. SUCCESS!

2 megjegyzés:

David Farrell írta...

Just wanted to say Thanks for the post - It really saved me today!

Emese írta...

You are most welcome David. Glad it could help someone out there!