Code: Select all
PHP Warning: mysqli_connect(): (HY000/2002): No such file or directory in <PATH>
From:
Code: Select all
$link = mysqli_connect("localhost","<username>","<password>","<DB>");
Code: Select all
$link = mysqli_connect("127.0.0.1","<username>","<password>","<DB>");
Code: Select all
When you use localhost as name, mysql will use a Unix socket instead that is handled through a file entry (mysql.sock, for example), not an Inet one, no matter if localhost is declared in /etc/hosts or not. However, when you use an ip address instead, even 127.0.0.1, you force mysql to open an Inet socket instead.