At the moment, I am writing a small application, which is intended to run in command line mode of Mac OS, and it requried a database connection. PHP is shipped with Leopard however MySQL isn’t. Then, I install XAMPP for a complete package. However, when I use Text Mate to write and test, it didn’t run correctly. It informed that “Can’t connect to local MySQL server through socket ‘/var/mysql/mysql.sock“. It’s quite werid, I did remembered that I turned MySQL server on already, so what happened here while I can still see my script in browser ? Just a while, actually, because the builti-in PHP recognized the wrong MySQL Sock path, so I need to correct it by doing this command:
ln -s /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock mysql.sock
This command created a symbolick link to MySQL socket in the XAMPP directory. And it worked. Simple trick but very useful.







