On Tue, Jun 1, 2010 at 9:30 AM, What you get is Not what you see <wygin...@gmail.com> wrote: > Freshly installed on openbsd 4.6 mysql,php and php5-mysql packages. > Done the configs. Now php and mysql works. But I couldnt make it > connect to mysql from within php with such a command > mysql_connect("localhost","user","pass") > It used to give "Cant connect to mysql through socket error" till I > change the command to > mysql_connect(127.0.0.1,"user","pass") > I want to learn why?
From: http://dev.mysql.com/doc/refman/5.0/en/connecting.html "On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to connect to the local server by using a Unix socket file." On OpenBSD, the MySQL socket file is outside the httpd chroot, so your PHP script can't access it. Accessing 127.0.0.1 over TCP is no problem. Paul. -- ------------------------------ Paul D. Ouderkirk Senior UNIX System Administrator p...@ouderkirk.ca ------------------------------ laughing, in the mechanism -- William Gibson