Using xampp: mysqli_connect(): (HY000/2002): No such file or directory

Not finding a solution, so here goes: mysql is running in the terminal but when I try to run a php test shell script I get the message:

mysqli_connect(): (HY000/2002): No such file or directory

I started mysql like this:

cd /Applications/XAMPP/xamppfiles/bin

sudo ./mysql.server start

Any ideas why I am having a connection problem?

Thanks

I’m not entirely sure of the proper way to fix this is (since I don’t use XAMPP - maybe check the hosts file?), but I’ve been told that if you use the IP address 127.0.0.1 instead of localhost, then that work-around should work.

@tpunt That worked! Thanks a million, trillion!!