[CLUE-Tech] MySQL + PHP 4.2 --> localhost.localdomain cannot connect?
David Jackson
david.j.jackson at pickledbeans.com
Mon Apr 29 19:34:02 MDT 2002
Jeff --
Does you connect.inc look like this, this returns more usefull error messages?
<?php
// database connect script
$dbhostname = "localhost";
$dbuser = "my_user_name";
$dbpasswd = "my_password";
$dbname= "my_db_name";
$link = mysql_connect("$dbhostname", "$dbuser", "$dbpasswd")
or die("Connection to server: $dbhostname FAILED!!");
mysql_select_db("$dbname")
or die("Connection to database: $dbname FAILED!!");
?>
David
> Greetings.
>
> I upgraded to PHP 4.2.0, statically linked into apache. When I try to
> connect to a MySQL database via a PHP script, PHP replies:
>
> Warning: Host 'localhost.localdomain' is not allowed to connect to
> this MySQL server ...
>
> Isn't that interesting?
>
> mysql> select host, user from user;
> +-----------+---------+
> | host | user |
> +-----------+---------+
> | localhost | phpesp |
> +-----------+---------+
>
> I was running PHP 4.0.0 and this script connected with MySQL, ran
> statements, etc. Nothing on the MySQL side changed. The PHP script
> passes 'localhost' for the host name to the MySQL connection.
>
> $db = mysql_connect('localhost','phpesp','php134esp');
>
> Nothing turned up on Google except a thread in the Zend/Development
> list -- someone observed the same behaviour, but no causes or
> workarounds were reported.
>
> On a lark, I changed the HOST column for this user from 'localhost' to
> 'localhost.localdomain' to no avail -- this doesn't work even via the
> 'mysql' command line.
>
> mysql> select host, user from user;
> +-----------------------+---------+
> | host | user |
> +-----------------------+---------+
> | localhost.localdomain | phpesp |
> +-----------------------+---------+
>
> Next, I updated the db table for the 'phpesp' database:
>
> mysql> select host,db from db;
> +-----------------------+------------+
> | host | db |
> +-----------------------+------------+
> | localhost.localdomain | phpesp |
> +-----------------------+------------+
>
> Still denied! I am stumped and appreciate any suggestions.
>
> Gracias,
> Jeff
> _______________________________________________
> CLUE-Tech mailing list
> CLUE-Tech at clue.denver.co.us
> http://clue.denver.co.us/mailman/listinfo/clue-tech
--
More information about the clue-tech
mailing list