Home > mac > Restarting MySQL in Mac OS X

Restarting MySQL in Mac OS X

Update: Apparently the method i mentioned below is incorrect, at least for Mac OS X!
Here’s the more proper way, simply:

launchctl stop com.mysql.mysqld

OR

launchctl list

and stop all process with mysql as the label, mysql should automatically restart. if it don’t simply

launchctl start com.mysql.mysqld

to bring it back to life!


Never really have to change any configuration to the mysql installation on my mac os x (10.6) (snow leopard). but when the need arises, i can’t seems to find my installation directory or how i can safely restart the mysqld services.

Good thing i found a few ways to do so!
To restart, start or stop your mysql server, you first need to identify your mysql installation base directory, that’s on assumption that you already have your mysql server up and running previously. Run the following sql command:

SHOW GLOBAL VARIABLES;

this command will return a list of variables along with its respective configured values. to find your base directory directly, you can just use the command below.

SHOW GLOBAL VARIABLES WHERE Variable_name = ‘basedir’;

The value returned will be something like this:

/usr/local/mysql-5.0.51a-osx10.5-x86/

from my case, it’s quite obvious that mysql installation was from 10.5, before i upgrade to snow leopard. So this guide may differs slightly for those who mac came with 10.6, i haven’t got the chance to confirm that yet. Now to restart your mysql server.

Simply go to terminal and enter the following command:

/usr/local/mysql-5.0.51a-osx10.5-x86/support-files/mysql.server restart

or you can cd into your basedir and then go into “support-files” folder.
then run

./mysql.server restart

the other option to stop and start will be as follows:

./mysql.server stop
./mysql.server start

, , ,

Comments:2

Leave a Reply
  1. Oliver 12/06/08

    Thanks for the info, but executing the first command above:
    launchctl stop com.mysql.mysqld
    I get the following error:
    launchctl stop error: No such process
    Same goes for ‘start’.
    This is on Snow Leopard. Any ideas?

  2. Steven 12/06/08

    How did you install your MySQL? I think this method only works for binary installations.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks:0

Listed below are links to weblogs that reference
Restarting MySQL in Mac OS X from How to Get it Working
TOP