Webserver: chrooted PHP gives mysql.sock error when attempting to reach mysql

Solution 1:

I solved my own issue. Jailkit couldn't create a hard link reference to mysqld.sock, as Ubuntu stores /var/run in tmpfs, which appears to the system to be a separate partition (which breaks hardlink functionality). I instead am now mounting /var/run/mysqld in the jail now, like so: mount --bind /var/run/mysqld /home/jail/var/run/mysqld/

Solution 2:

How about using as host value 127.0.0.1? It uses TCP connection which doesn't write socket (unlike localhost value on unix).