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

, , ,

Mac: Merging Folder Content

Filed in mac Leave a comment

Mac OS X do not merge folder content when folder of same name is copied from one location to another.
The terminal command will overwrite the sub-folder content of the destination folder if there are sub-folder of the same file name. Sounds a bit confusing, but if you try copying folders with files & folder inside, you should get the idea.

mv /src_folder/ /destination_folder/

Unknowingly, Mac OS actually have a command for you to merge folder content.

ditto /src_folder/ /destination_folder/

Find out more about ditto from Mac OS X Reference Library

, , ,

Mac OS X: Purging Inactive Memory

Filed in mac Leave a comment

Warning: Although this command should be generally safe, please make sure you have quit all your application and nothing important is running before trying this.

If inactive memory seems to be something that bothers you, use the following command in Terminal to purge it:


it’s surprising that simple, but totally at your own risk.

Source: Using purge to free inactive memory on Mac OS X

, , , , ,

Mac: Disk Utility, Format Fail

Filed in hardware | mac Leave a comment

I see a lot of post or google results when i try to google: “file system formatter fail”.
i got this error when i was trying to format my 1 Tera Maxtor HDD to be Mac OS Extended (Journaled), the problem here is, it a previously a MS-DOS(FAT) format. So the partition is actually Master Boot Record for booting into DOS or Windows based computer.
To solve this, you will realise you have gotten that extra “Partition” tab along with the “Repair”, “Erase”, “Raid”, “Restore” tabs. Go to that tab and then under the advance option, select your partition to be “GUID”.
And tada, you will be able to properly format your HDD to Mac OS Extended.

Quite dump on Disk Utility to not automatically resolve this problem.

, ,