Or even simpler solution, tell MySQL to use TCP connections instead of UNIX sockets by connecting to "127.0.0.1" instead of "localhost".Broken record: linking only works until you restart the server manually, as mysqld removes the socket and re-creates it when starting. The location of the socket is configured in /etc/my.cnf. To use mysql with chrooted Apache / Nginx either use TCP connections, or set both /etc/my.cnf and /var/www/etc/my.cnf to point to a place inside the chroot jail.
Karlis