Read my latest article: Planet Argon Blog (posted Wed, 17 Feb 2010 15:11:00 GMT)

Starting MySQL after upgrading to OS X Leopard

Posted by Robby Russell Sat, 27 Oct 2007 11:13:00 GMT

27 comments Latest by abercrombie clothes Wed, 17 Mar 2010 07:40:27 GMT

If you upgraded to OS X Leopard and are running MySQL from the MySQL.com installer1, you might be having some problems with starting it from the GUI interface. There isn’t a fix from MySQL yet, so to get around that… you can run it from the command-line.

Start MySQL from the command line

cd /usr/local/mysql; ./bin/mysqld_safe &

This should get MySQL up and running for you. If someone wants to share a tip on how to get this to start automatically on reboot, please post a comment and I’ll help get the word out.

1 I didn’t have this problem as I installed MySQL via MacPorts... but this came up for a few members of PLANET ARGON after they upgraded to Leopard.

Subscribe to my RSS feed Enjoying the content? Be sure to subscribe to my RSS feed.
Comments

Leave a response

  1. Avatar
    Greg Newman Sat, 27 Oct 2007 12:35:34 GMT

    Use sleepwatcher with a .wakeup script to start it up.

  2. Avatar
    Greg Newman Sat, 27 Oct 2007 12:37:34 GMT

    I just tried installing MySQL from macports and it fails due to zlib dependency issues on leopard. How’d you get it working Robby?

  3. Avatar
    David smalley Sat, 27 Oct 2007 16:40:19 GMT

    Probably not the safest thing to do, but I saw someone on the official mysql bug report for this suggest doing…

    sudo chmod -R 777 /usr/bin/mysql

    It did that and it all works, even starting from the os x preference pane.

    Hopefully not too difficult for mysql to track down what is causing that if its just a permissions issue.

  4. Avatar
    jerome Sat, 27 Oct 2007 20:09:12 GMT

    which version is installed ?

  5. Avatar
    Scott Sat, 27 Oct 2007 21:49:44 GMT

    I got it to autoboot from a fresh 10.5 install after doing what I posted here:

    http://railsforum.com/viewtopic.php?id=12367

    I can elaborate if you need

  6. Avatar
    onizuka Sat, 27 Oct 2007 23:56:45 GMT

    Another easy way is make an Automator application and have it loaded at startup. Just run Automator, all ‘Run shell script’ from Utilities to the workflow, paste ‘sudo /usr/local/mysql/bin/safe_mysqld’ in the text field, save the workflow as an application, and then add this application to you account startup items. Arguably convenient solution, I admit.

  7. Avatar
    andyengle Sun, 28 Oct 2007 04:36:35 GMT

    Hi Rob.

    I checked one of the MySQL error logs on my Mac (running 10.5 Leopard) and found the following:

    /usr/local/mysql/bin/mysqld: Can’t read dir of ’/var/folders/M3/M3v1D9jnFHK0OBHWImeudU+++TI/Tmp/ ’ (Errcode: 13)

    That error was in the /usr/local/mysql/data/Macintosh.local.err file.

    So, I went to /var/folders/M3/M3v1D9jnFHK0OBHWImeudU+++TI/, did chmod 777 on both M3 and the M3v1D… directories, then MySQL started. Those directories appear to be temporary directories (I’ve not seen them before Leopard), but changing the mode on those appeared to fix the problem.

    One other note: my MySQL log file (which was originally called blacktoe.log) is now called Macintosh.log. Blacktoe is the name of my machine, but evidently now MySQL is being made to write the log to that Macintosh.log file, which is also in that /usr/local/mysql/data directory.

  8. Avatar
    David Sun, 28 Oct 2007 05:08:21 GMT

    I enabled the default PHP included with Leopard (5.1.4 I think), and it’s configured to find the MySQL socket in the /tmp folder, rather than /var/mysql/ as is configured with MySQL from mysql.com. This was giving me “unable to connect to database” errors with my web pages, and I solved it by creating a symbolic link named “mysql” in the /var directory that links to /tmp. Problem (temporarily) solved. I figured I’d toss that out in case anybody else is having the same problem.

  9. Avatar
    Greg Newman Sun, 28 Oct 2007 11:13:15 GMT

    This seems to work

    http://angry-fly.com/index.cfm/2007/10/26/Fix-for-MySQL-on-Leopard

    It also seems to be over at the apple support forums

  10. Avatar
    Josh Kieschnick Mon, 29 Oct 2007 19:44:40 GMT

    @Greg Newman

    I was having the same problems with the zlib dependency, but that was fixed once I installed Xcode 3 from the Leopard CD.

  11. Avatar
    Anna Mon, 29 Oct 2007 20:54:46 GMT

    I am looking for this for a long time. Thanks very much.

  12. Avatar
    Hasani Hunter Mon, 29 Oct 2007 21:33:13 GMT

    I use the following plist for launchd: “com.mysql.mysqld.plist” located in ”/Library/LaunchDaemons”

    To start: sudo launchctl load com.mysql.mysqld.plist To stop: sudo launchctl unload com.mysql.mysqld.plist

    Oh and make sure that the mysql installation is owned by _mysql and _mysql group.

    <?xml version=”1.0” encoding=”UTF-8”?> <!DOCTYPE plist PUBLIC ”-//Apple Computer//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”> GroupName _mysql Label com.mysql.mysqld OnDemand Program /usr/local/mysql/bin/safe_mysqld RunAtLoad UserName _mysql WorkingDirectory /usr/local/mysql
  13. Avatar
    Hasani Hunter Mon, 29 Oct 2007 21:38:11 GMT

    Let’s try this again..

    I use the following plist for launchd: “com.mysql.mysqld.plist” located in ”/Library/LaunchDaemons”

    To start: sudo launchctl load com.mysql.mysqld.plist To stop: sudo launchctl unload com.mysql.mysqld.plist

    Oh and make sure that the mysql installation is owned by _mysql and _mysql group.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>GroupName</key>
            <string>_mysql</string>
            <key>Label</key>
            <string>com.mysql.mysqld</string>
            <key>OnDemand</key>
            <false/>
            <key>Program</key>
            <string>/usr/local/mysql/bin/safe_mysqld</string>
            <key>RunAtLoad</key>
            <true/>
            <key>UserName</key>
            <string>_mysql</string>
            <key>WorkingDirectory</key>
            <string>/usr/local/mysql</string>
    </dict>
    </plist>
    
  14. Avatar
    Jimmy Wed, 31 Oct 2007 18:42:49 GMT

    Upgrading to Xcode 3.0, then installing mysql with macports worked great for me.

  15. Avatar
    Joannou Ng Thu, 01 Nov 2007 23:16:58 GMT
  16. Avatar
    Chris Chandler Tue, 06 Nov 2007 14:33:12 GMT
  17. Avatar
    Ash Tue, 11 Mar 2008 23:39:21 GMT

    Hi, I can’t start mysql v. 4 or 5. Using Leopard on a power pc. I get the following error

    :MySQL local$ /Library/MySQL/bin/mysqld_safe & [1] 480 :MySQL local$ touch: /Library/MySQL/var/localhost.local.err: Permission denied chown: /Library/MySQL/var/localhost.local.err: No such file or directory Starting mysqld daemon with databases from /Library/MySQL/var /Library/MySQL/bin/mysqld_safe: line 302: /Library/MySQL/var/localhost.local.err: Permission denied /Library/MySQL/bin/mysqld_safe: line 308: /Library/MySQL/var/localhost.local.err: Permission denied STOPPING server from pid file /Library/MySQL/var/localhost.local.pid tee: /Library/MySQL/var/localhost.local.err: Permission denied 080311 16:34:08 mysqld ended

    What did I do wrong? I have been trying to find a solution for 2 weeks but nothing. Others have this same issue but I haven’t seen a solution yet. Thanks.

  18. Avatar
    Ash Tue, 11 Mar 2008 23:39:27 GMT

    Hi, I can’t start mysql v. 4 or 5. Using Leopard on a power pc. I get the following error

    :MySQL local$ /Library/MySQL/bin/mysqld_safe & [1] 480 :MySQL local$ touch: /Library/MySQL/var/localhost.local.err: Permission denied chown: /Library/MySQL/var/localhost.local.err: No such file or directory Starting mysqld daemon with databases from /Library/MySQL/var /Library/MySQL/bin/mysqld_safe: line 302: /Library/MySQL/var/localhost.local.err: Permission denied /Library/MySQL/bin/mysqld_safe: line 308: /Library/MySQL/var/localhost.local.err: Permission denied STOPPING server from pid file /Library/MySQL/var/localhost.local.pid tee: /Library/MySQL/var/localhost.local.err: Permission denied 080311 16:34:08 mysqld ended

    What did I do wrong? I have been trying to find a solution for 2 weeks but nothing. Others have this same issue but I haven’t seen a solution yet. Thanks.

  19. Avatar
    Philippe Tue, 11 Mar 2008 23:54:43 GMT

    Have you tried sudo mysqld_safe ?

  20. Avatar
    Philippe Tue, 11 Mar 2008 23:55:02 GMT

    Have you tried sudo mysqld_safe ?

  21. Avatar
    dana.moore@bbn.com Thu, 01 May 2008 17:20:41 GMT

    thanks for the tip; the command line approach works fine. Some day I will have to upgrade to an X86 based Mac. Just hate to toss out a perfectly good development envt

  22. Avatar
    Darren Tue, 16 Sep 2008 23:08:23 GMT

    @Ash Do this:

    $ cd /usr/local/mysql $ sudo chown -R mysql data/ $ sudo echo $ sudo ./bin/mysqld_safe &

    That should fix chown problems and start mysql. Write /usr/local/mysql/: in your PATH variable in your .bash_login or profile if you don’t want to write /usr/local/mysql everytime.

  23. Avatar
    Tyler Mon, 12 Jan 2009 19:53:52 GMT

    I am very new to mysql and configuring my own software. I am running into the following problem when I try to run mysqld_safe. I have already run mysql_install_db, but when I try to actually run mysql it gives this error. I am on Leopard.

    :mysql ImmaculataStudios$ sudo mysqld_safe Starting mysqld daemon with databases from /usr/local/var STOPPING server from pid file /usr/local/var/my-macbook-pro.local.pid 090112 11:49:43 mysqld ended

    I am thinking it’s a permission problem, but I don’t know how do deal with that.

  24. Avatar
    abercrombie clothes Wed, 17 Mar 2010 07:19:17 GMT

    Use sleepwatcher with a .wakeup script to start it up.

  25. Avatar
    abercrombie clothes Wed, 17 Mar 2010 07:29:32 GMT

    Probably not the safest thing to do

  26. Avatar
    abercrombie clothes Wed, 17 Mar 2010 07:29:33 GMT

    Probably not the safest thing to do

  27. Avatar
    abercrombie clothes Wed, 17 Mar 2010 07:40:27 GMT

    Use sleepwatcher with a .wakeup script to start it up

Share your thoughts... (really...I want to hear them)

Comments