Restarting MySQL in Mac OS X

Filed in mac 2 Comments

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


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:


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:


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

, , ,