Splash of Style...Macs, Photography, Design, and other Passions

MySQL Broken after Mac OS X Update

January 14, 2006 by debbie T | ApacheContent ManagementMac Software

Thanks to Miraz at MacTips.info for the heads up on this.

After updating to Mac OS X 10.4.4, some are finding their local databases are broken. I checked my MySQL database and as suspected, it is not working.

After some reading this morning, I think I finally understand what happened. After the update, PHP cannot find MySQL. An entry at Relative Sanity explained it very well.

What I did on my system:

launch terminal, and type

sudo cp /etc/php.ini.default /etc/php.ini

the sudo command allows you temporary access as root user. You will need to type in your password. This command will create a copy of the php.ini.default file and name it php.ini (IMPORTANT: if you already have a php.ini file, there is no need to replace it with the default file, so skip this step. I followed this step, and now, I am hoping I didn’t already have a php.ini file with some edits. Oh well, I will soon find out.)

Open the php.ini file in text editor. I use pico/nano in Terminal.

sudo pico /etc/php.ini

you can also type

sudo nano /etc/php.ini

Again, this will access the file as root user (sudo command) – you might need to type password again.

Once the file is open in the text editor, search by clicking ctrl+W (Whereis) and type “mysql.default_socket” (no quotes.) You should find this line of code:

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = 

Add this bit of code /tmp/mysql.sock so PHP knows where to find MySQL

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /tmp/mysql.sock

Click ctrl+X (to exit and save), Type “y” to save, and enter to name the file.

Restart Apache. The command I use for this is

sudo /usr/sbin/apachectl restart

TIP: I use Mac Stickies to keep frequently used terminal commands and other notes. I keep Stickies in my Dock, and when needed I launch the application.

It looks like MySQL is working now. Hopefully there won’t be any other problems later.

More linked details can be found at Mac OS X Hints

Commments are closed for this article.