Article:
  Apache Web-Serving With Mac OS X, Part 5
Subject:   mysql socket problem - solved differently
Date:   2009-08-23 07:27:49
From:   ekklisis
Response to: mysql socket problem

After spending a few hours on the console, without knowing much about how to use it, I realized that some of the links provided in the above article were not working in my ibook, because the installation path is different. So I decided to write a simple complement for those who might encounter the same problems.


First of all, Mark Liyanage's double-clickable MySQL page sent me to the following link, which asked me to register.
http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-standard-4.1.22-apple-darwin8.6.0-powerpc.dmg/from/pick


Of course I didn't register, so I googled for a mirror of the file to be downloaded:
mysql-standard-4.1.22-apple-darwin8.6.0-powerpc.dmg


The particular package contains a startup item, which I also installed for restarting the MySQL server every time I restart my computer.


After installation I was supposed to say hello to MySQL, as Kevin's article suggests, but I got the above-mentioned frustrating, yet stupid error.


The solution:
We open a command shell.
we change dir to /private/etc with the command:


cd /private/etc


We copy the file php.ini.default to a writable directory in order to be able to edit it. (chmod did not work in my case). I used the commands:


cd /

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


Then I opened it with the pico text editor:


pico php.ini.default


I hit ctrl+W to find mysql.default_socket =
and I changed it to:
mysql.default_socket = /private/temp/mysql.sock


Ctrl+O to save
and
Ctrl+X to exit the editor.


Then to put the file back in its place:


sudo mv php.ini.default /private/etc/php.ini.default


(Of course it asked whether I wanted to overwrite the old file and I said yes.) Unfortunately I don't remember whether it needs a chmod +w so, you'll have to figure it out yourself.


Then I followed the advice of our fellow user carlco2 posted at his comment "Mysql socket problem solved.. OSX10.4 2006-06-23 04:59:13"


sudo mkdir /var/mysql

sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock 


I then restarted and wow! MySQL server did not only start automatically, but also php and MySQL could meet each other, enabling me to finally run Kevin's "test.php" and excitedly say hello to MySQL ;)


I will be happy if my blah blah becomes of some help to someone.
Thanks for reading!