Re: Problem Connecting to MySQL from PHP3...Please Help...

From: Date: Tue, 27 Jun 2000 22:28:41 +0000
Subject: Re: Problem Connecting to MySQL from PHP3...Please Help...
Groups: php.db 
Request: Send a blank email to php-db+get-674@lists.php.net to get a copy of this message
Addressed to: Hendrix <tgjp@thezone.net> php-db@lists.php.net ** Reply to note from Hendrix <tgjp@thezone.net> Tue, 27 Jun 2000 07:12:23 -0230 > > Hi guys, > > See if you can follow me here.... I am running a standalone computer > which has both the apache and mysql server running on it... Although > not connected to a network, I have a NIC activated as "eth0".... My > host table has an entry for both "localhost" and "hendrix"... > "hendrix" is the host name that I have given my machine. My "hosts" > file appears as follows: > > 127.0.0.1 hendrix.BluesCafe 42.5945244 > 198.168.0.1 hendrix.BluesCafe hendrix Are you sure you don't want to use 192.168.0.1. That is the proper RFC1918 address. (Private, not routed on the Interent.) 198.x.x.x belongs to someone, somewhere. > Okay...*s* My problem is that I can connect to the MySQL server from > PHP with the following command: > > mysql_connect ("localhost","tpenney", "<password_here>"); > > But... I can't connect to the server with this command: > > mysql_connect ("hendrix","tpenney", "<password_here>"); > When you connect to localhost, MySQL uses a UNIX socket, which is a special file on your system. When you try to connect to some other hostname (hendrix) it tries to use the network. As long as the server is on the same machine, you want to use localhost, as it is faster. Can you ping/telnet to hendrix? What does your ifconfig and route look like? Do you realy care, since there is no real network, and localhost is the preferred way to access a database on the local machine? Rick Widmer Internet Marketing Specialists www.developersdesk.com

« previous php.db (#674) next »