Starting MySQL From the Command Line in OS X Server

So, I had to start MySQL from the command line in Mac OS X Server this morning. I don’t usually blog on super technical topics, but I had a hard time finding the answer to my question with Google this morning of how to do this. So, I’m blogging it in hopes that I can answer this question for the masses in case they need it.

To start or boot MySQL from the command line in Mac OS X Server:

sudo ./bin/mysqld_safe

Enter your sudo password. And, you’re back up and running. Brilliant!

Popularity: 2% [?]

  • Thanks Norm! This is great.
  • Hey Dave:

    Just a quick note on how to start MySQL from the command line on Mac OS X Server. Your command [sudo ./bin/mysql_safe] assumes you are already in the proper MySQL directory, which most certainly won't be the case if you just launched Terminal.app.

    I mention this because the actual directory where MySQL resides depends on which version of MySQL you have installed. Mac OS X Server comes with different versions of MySQL, depending on the version of Server you are running. Here's a quick run down:

    *Mac OS X Server *MySQL Version*
    Version*
    10.2-10.2.2 3.23.51
    10.2.3-10.2.6 3.23.53
    10.3 4.0.14
    10.3.2 4.0.16

    The current stable version of MySQL available from http://www.mysql.com/ is 4.1.11. Apple installs the bundled version of MySQL in one place [/usr/share/]and the MySQL Mac OS X installer installs MySQL in another place[/usr/local/. This can be confusing. Also, since version 4.0.15, MySQL has included a "Startup Items" script that you can use to start and stop the MySQL server. The location of this script has also changed with newer versions of MySQL.

    Given that the bundled version of MySQL is pretty old compared with what is the current stable version, I would suspect many people have downloaded and installed a MySQL Mac OS X Server build. To that end, here is an except from the MySQL ReadMe regarding how to start the MySQL server from the command line (as opposed to using the Startup Items script or the new Preference Pane they also include now):

    shell> cd /usr/local/mysql
    shell> sudo ./bin/mysqld_safe
    (Enter your password, if necessary)
    (Press Control-Z)
    shell> bg
    (Press Control-D or enter "exit" to exit the shell)

    Sorry, I didn't mean for this comment to be so long. Hope it is useful.

    Norm
blog comments powered by Disqus