PHP Can't Connect to MYSQL as LOCALHOST
Posted: Fri Jul 21, 2006 8:30 am
I'm new to PHP and MYSQL development, and have been experiencing problems getting PHP to connect to MYSQL.
If I use either of the standard connection statements to connect to a database server running locally
$db = mysql_pconnect('localhost', 'php_webuser', 'php123xx');
or
$db = mysql_pconnect('127.0.0.1', 'php_webuser', 'php123xx');
the connection fails.
If however, I state the full network address of the local machine, e.g.
$db = mysql_pconnect('192.168.100.100', 'php_webuser', 'php123xx');
the connection is successful.
Can anyone point me in the direction of why the first method is failing?
Many thanks,
Bryan
If I use either of the standard connection statements to connect to a database server running locally
$db = mysql_pconnect('localhost', 'php_webuser', 'php123xx');
or
$db = mysql_pconnect('127.0.0.1', 'php_webuser', 'php123xx');
the connection fails.
If however, I state the full network address of the local machine, e.g.
$db = mysql_pconnect('192.168.100.100', 'php_webuser', 'php123xx');
the connection is successful.
Can anyone point me in the direction of why the first method is failing?
Many thanks,
Bryan