Saturday, December 25, 2010

MySQL 5.5 Startup Problems On OS X 10.6.5

Today morning I downloaded MySQL Community Server 5.5.8 for OS X 10.6.5. I downloaded 64bit disk image and started installation by first installing mysql-5.5.8-osx10.6-x86_64.pkg, followed by startup item - MySQLStartupItem.pkg - and then the system pref pane - MySQL.prefPane. Everything went well with the installation. After that I opened System Preference and clicked on MySQL pane to start the server. When I clicked on Start MySQL Server button, nothing happened. Neither server started nor did I get any confirmation message or any error message. Reason for such failure to start is the server startup script - mysql.server - is missing the MySQL installation directory path as well as MySQL data directory path. To resolve this locate basedir= and put entry as shown below and save the file. mysql.server file can be found under /usr/local/mysql/support-files directory

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

Alternatively above entries can also be put in /etc/my.cnf file too. Better place to put this instead of modifying packaged/default startup script - /usr/local/mysql/support-files/mysql.server. Anyway its individual choice.

Now try to start the server by clicking Start MySQL Server button in MySQL System Preference pane. I could start the server and can create a new server instance using MySQL Workbench. I was a happy man. But my happiness did not end long. As soon as I restarted my laptop, I got an annoying alert...

Insecure Startup Item disabled. “/Library/StartupItems/MySQLCOM” has not been started because it does not have the proper security settings.
This was because an entry in /etc/hostconfig as MYSQLCOM=-NO-. Due to ownership issue on startup item MySQLCOM, above alert was flashing on OS startup. To fix this just change the ownership of MySQLCOM startup item as shown below

sudo chown -R root:wheel /Library/StartupItems/MySQLCOM
To test just logoff or restart the system and that Insecure Startup Item disabled alert should not come again.

Cheers !!!
- Jay

48 comments:

  1. Jay,
    thanks for taking the time to post your experiences - I have been having the same problem. However, I simply cannot find the file mysql.server - where is it located?

    ReplyDelete
  2. Glad that it helped. You can find mysql.server under /usr/local/mysql/support-files directory. I'll update the article to have this location. Thanks for your comment.

    ReplyDelete
  3. THANK YOU!!!! The "insecure startup item" was driving me nuts!
    I really don't understand:
    a) how the folks at MySQL blew it so bad when creating the Mac installer
    b) why they have been unresponsive to the bug reports I've filed on this
    This is no small thing, and I'd have thought they'd be all over it.

    ReplyDelete
  4. thanks a lot - i even tried reinstalling mysql last night before i came across your entry today! - Fortunately it was my home machine not my production machine that went belly up because of the update. At this point I'd really appreciate if apple came up with their own mamp like system that's easier to maintain and configure on osx client.

    ReplyDelete
  5. Huge help to me, too. Thanks Jay.

    ReplyDelete
  6. You can also add a my.cnf in folder ect with:
    basedir=/usr/local/mysql
    datadir=/usr/local/mysql/data

    --Frank

    ReplyDelete
  7. Thank you soooo much. This problem was driving me nuts the whole day.

    Greetings from Austria,

    Hannes

    ReplyDelete
  8. great! Thanks.

    ReplyDelete
  9. @ Frank, thanks for pointing out my.cnf. I guess its better place to put this instead of default startup script. I'll update the article accordingly.

    ReplyDelete
  10. The above and several other posts online regarding this still didn't get mysql working for me. If anyone else is still having problems after trying the above, see

    http://blog.salientdigital.com/2010/12/31/mysql-wont-start-on-snow-leopard/

    Nutshell:

    sudo mysqld_safe -u root

    ReplyDelete
  11. I found the file, but could only open it with TextEdit in order to add the code. However it wouldn't let me save it even though I have permissions. What app should be used?

    ReplyDelete
  12. @ Liam you can open it using vi from terminal. just enter "sudo vi /usr/local/mysql/support-files/mysql.server" (without quotes).

    You can also create my.cnf file under /etc directory. Since you have created it you can edit/save it without sudo permission

    ReplyDelete
  13. This was a fantastic post! Really appreciate it! Worked for me!

    ReplyDelete
  14. Thanks Jay, you're a lifesaver. :-)

    ReplyDelete
  15. Legend Jay...many thanks!

    ReplyDelete
  16. Thank you, thank you, thank you and thank you.

    ReplyDelete
  17. This was great. Thank you.

    ReplyDelete
  18. Thanks for posting this! The MySQL manual was no help at all...you are a lifesaver

    ReplyDelete
  19. amazing, thanks a lot, it solved my problem !

    ReplyDelete
  20. thanks, i spent hours with solutions from other posts but this is the only solution that works!

    ReplyDelete
  21. Thanks you Sir! dreadful mysql install on a MAC

    ReplyDelete
  22. Thank you, this enabled me to start my 5.5.8 server. I noticed your user feedback on http://dev.mysql.com/, read your blog, noticed the absence of the basedir and datadir values in my own installation, and fixed it through your advice.

    ReplyDelete
  23. Thanks a lot!

    ReplyDelete
  24. Thanks for the information , now MySQLServer is working fine . . .

    I installed mysql-5.5.8 on Mac OSX 10.6.6 , have the exactly the same problems :)


    Cheers from México !!

    ReplyDelete
  25. Thanks a lot for the information but i face an error when i try changing the MySQLCOM file. After typing in the command in terminal it asks me for my password and then i receive an error message saying

    "chown: /Library/StartupItems/MySQLCOM: no such file or directory"

    ReplyDelete
  26. @ Ashish, have you installed MySQLStartupItem.pkg after installing mysql-5.5.8-osx10.6-x86_64.pkg?

    ReplyDelete
  27. did that....it works now! thanks once again! :D

    Ashish tayal

    ReplyDelete
  28. When trying to start the mysql server, its giving me this error

    "ERROR! The server quit without updating PID file ..."

    ne solution?

    ReplyDelete
  29. @ ChinmaY, no idea on this error, but a quick goole gave this links. May be useful

    http://icesquare.com/wordpress/starting-mysql-error-the-server-quit-without-updating-pid-file/

    http://icesquare.com/wordpress/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file/

    ReplyDelete
  30. When i start mysql it shows the error window? If i use mysqld.exe it tells that could not connect to localhost?

    ReplyDelete
  31. works. thanks

    ReplyDelete
  32. The "MySQL System Preference pane" that comes with the 64bit package of MySQL 5.5.9 does not work on intel-based macs :(
    I installed only the prefpane from MySQL 5.1.51 and it's all sorted...

    Anyone knows the remedy for this prefpane of 5.5.9?

    ReplyDelete
  33. Thanks heaps, solved the problem :)

    ReplyDelete
  34. Jay,
    Im not familiar with terminal. can u post a detail to solve this problem
    best regards
    Hazwan

    ReplyDelete
  35. Hazwan, terminal is like command prompt in windows. You can find Terminal.app under /Applications/Utilities directory

    ReplyDelete
  36. Jay,
    Yup i know that. the problem here. the guideline is quite blur. I still in learning process in using terminal. I'm not quite familiar with it. Can u show me detail guideline to solve this problem. sharing is caring. ^^ tq for reply my comment

    ReplyDelete
  37. Hazwan, not sure exactly which part is "blur" if you can be specific I can try to clear your doubt...

    ReplyDelete
  38. Thanks, Jay! I have been having a variety or problems since installing this version of MySQL and your post solved this one for me. Now if could only figure out why it won't let me delete the 'test' db… :-)

    ReplyDelete
  39. @ neo, glad that this post helped you. Regarding deleting test db using mysqladmin remove the test db (mysqladmin drop test). You might get following error

    error: 'Error dropping database (can't rmdir './test/', errno: 17)'

    This because mysqladmin could not delete the data dir of your test schema. Go to /usr/local/mysql/data directory and remove the directory test and you should be fine.

    Word of caution, Above operation will delete all tables and any objects you have created. So before performing any of above, make sure you dont have any of your data.

    ReplyDelete
  40. Very helpful!!! thank you!

    ReplyDelete
  41. This was a good post. For me, I used fink to install MySQL and needed to use the below in the my.cnf and mysql-server files

    basedir=/sw
    datadir=/sw/var/mysql

    and also create links (ln -s) to setup the default looking paths that the panel looks for.

    ln- s /sw /usr/local/mysql
    ln -s /sw/share/mysql /usr/local/mysql/support-files

    ReplyDelete
  42. Thanks -- It is very concise, clear & helpful.
    David Chhetri

    ReplyDelete

 
Disclaimer: This is a personal blog and all content represent what I think and it does not advocate/support/advertise any other person/company. I do not earn money or intended to do so with this blog or any of the contents the blog hosts. If I post something here that you find helpful, that's wonderful. Just in case, if I say something stupid, the stupidity is mine, and mine alone and I can not be held for anything if you fall for such stupidity :-). I cannot be held responsible for any kind of damage that may be caused by downloading or viewing the files or information provided herewith. Anybody and everybody can use/refer the contents of this blog at their own will and of course at own risk. There is no need for any kind of approval of the author. Although it would be great if feedback is left for any such usage to the author