Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using this command to create a symbol link to mysql.sock in Mac

If run mysql_connect() in php cli and return this error:

PHP Warning:  mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in Command line code on line 1PHP Warning:  mysql_connect(): No such file or directory in Command line code on line 1

Using this command to create a symbol link to mysql.sock in Mac

# XAMPP
sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock /var/mysql/mysql.sock
# MAMP
sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock
# AMPPS
sudo ln -s /Applications/AMPPS/mysql/tmp/mysql.sock /var/mysql/mysql.sock
@nahumnp

This comment has been minimized.

nahumnp commented Jun 1, 2018

In my case.
sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock /tmp/mysql.sock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment