MySQL 5 Server Cannot Start on Apple Mac Leopard

There were some problem during configuring MySQL5 Server on Leopard with MacPorts when creating default db with command;

sudo -u mysql mysql_install_db5

Error Messages;

shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
mkdir: /opt/local/var/db/mysql5: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
chmod: /opt/local/var/db/mysql5: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
mkdir: /opt/local/var/db/mysql5: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
chmod: /opt/local/var/db/mysql5/mysql: No such file or directory
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
mkdir: /opt/local/var/db/mysql5: Permission denied
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
chmod: /opt/local/var/db/mysql5/test: No such file or directory

It’s the permission issue, to generate default, try this command;

sudo mysql_install_db5

Now MySQL5’s default DB should be successfully initializes to /opt/local/var/db/mysql5. But there is some problem when starting MySQL;

shell> sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start
Starting MySQL
/opt/local/share/mysql5/mysql/mysql.server: line 159: kill: (31272) – No such process
ERROR!

Have a look at the system.log file on your Leopard;

Jun 9 17:09:59 redarrows com.apple.launchd[1] (0×10bac0.nohup[31285]): Could not setup Mach task special port 9: (os/kern) no access
Jun 9 17:09:59 redarrows com.apple.launchd[1] (0×10bac0.nohup[31286]): Could not setup Mach task special port 9: (os/kern) no access
Jun 9 17:09:59 redarrows com.apple.launchd[1] (0×10bac0.nohup[31291]): Could not setup Mach task special port 9: (os/kern) no access

This should be the permission issue on MySQL database folder, to solve this, chown your mySQL db folder to _mysql:_mysql…

sudo chown -R _mysql:_mysql /opt/local/var/db/mysql5

Now go to the db dir and see the permission;

shell> cd /opt/local/var/db/
shell> ls -al mysql5
drwx—— 5 _mysql _mysql 170B Jun 9 17:09 mysql5

Now, try to start MySQL5 Server again;

shell> sudo /opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper start
Starting MySQL
SUCCESS!

Hell ya, MySQL5 successfully running on your machine! Voila, Happy MySQL-ing with your Apple Mac Leopard!

Related posts:

  1. Install MySQL5 Server on Apple Mac Leopard with MacPorts Previously I wrote a post on “installing postgresql 8.2 on...
  2. MySQL Cannot Connect with PHP in OSX I think some of you might have problem connecting to...
  3. How do I Start Application Services with launchctl When Apple Mac Leopard Boot Up If you have MySQL, PostgreSQL, Apache2 or other application installed...
  4. postgresql82-server compile error on Apple Leopard with Macports 1.5 I wasn’t able to compile postgresql82-server on my machine, it’s...
  5. Install MySQL5 on Mac OSX With Darwin Port Before installing MySQL5, please be sure you have Darwin Port...
  6. MySQL Quick Installation on FreeBSD Quick installation of MySQL Database on FreeBSD Server. Make sure...
  7. What is umask? umask? What? What is umask command use for in linux/unix...
  8. installing postgresql 8.2 on Leopard with macports postgresql! one of my favorite high performance open source db,...
  9. PostgreSQL Database signal 6 Error On Apple Mac After I have done PostgreSQL upgrade through MacPort, the database...
  10. Microsoft Windows 2000 – Problem Starting Computer Management Console When are you having problem to start up Computer Management...

5 Responses to “MySQL 5 Server Cannot Start on Apple Mac Leopard”

  1. Dmitry Says:

    Thanks for your article, it was really helpful for me.

    But please, fix the mistype here:
    sudo chwon -R _mysql:_mysql /opt/local/var/db/mysql5

    must be chOWn, not chwon.

  2. takizo Says:

    sorry bro for the typo error :)

  3. annon Says:

    wow p why a you u so l pro. my idol. muax

  4. Rob Says:

    If it helps anyone else, I also had to run the following to get this to work:

    sudo chown -R _mysql /opt/local/var/run/mysql5/

    Thanks for the tip! Big, big help.

  5. takizo Says:

    no problem Rob. Thanks for sharing your tips with us too.

Leave a Reply