Connecting MySQL via PHP in Mac OS

Connecting MySQL via PHP in Mac OS

Mac default MySQL server install socket files at /tmp/ directory while PHP look for socket file at /var/mysql/ location. So PHP is not possible to connect MySQL.

This issue can be overcome by creating symbolic links as follow

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

Share

Recommended Posts

Leave a Reply

Your email address will not be published. Required fields are marked *