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

From: Date: Tue, 27 Jun 2000 09:42:58 +0000
Subject: Problem Connecting to MySQL from PHP3...Please Help...
Groups: php.general 
Request: Send a blank email to php-general+get-3301@lists.php.net to get a copy of this message
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 lo 198.168.0.1 hendrix.BluesCafe hendrix My user table is as follows (select host,user from user;): +-----------+---------+ | host | user | +-----------+---------+ | hendrix | tpenney | | hendrix | root | | localhost | root | | localhost | tpenney | +-----------+---------+ My host table is as follows (select host,db from host;): +-----------+----+ | host | db | +-----------+----+ | localhost | % | | hendrix | % | +-----------+----+ My db table is as follows (select host,db,user from db;): +------+---------+------+ | host | db | user | +------+---------+------+ | % | test | | | % | test\_% | | +------+---------+------+ 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>"); Obviously, the server is excepting connections from "localhost" but not from "hendrix"... Although they represent the same machine, and I have entries for them in the respective privilege tables.... I'm thinking that there may be an entry in the "hosts" file that I am missing, but I am unsure...!!! Is it true that if I am sitting at the server, I can only connect to it by using the "localhost" connection name...???? Here is a list of the error messages that I recieve: <--------ERROR MESSAGE STARTS HERE--------> -- Warning: MySQL Connection Failed: Host 'hendrix.BluesCafe' is not allowed to connect to this MySQL server in /usr/local/apache/htdocs/submitform.php3 on line 4 Warning: MySQL Connection Failed: Access denied for user: 'apache@localhost' (Using password: NO) in /usr/local/apache/htdocs/submitform.php3 on line 5 Warning: MySQL: A link to the server could not be established in /usr/local/apache/htdocs/submitform.php3 on line 5 Warning: MySQL Connection Failed: Access denied for user: 'apache@localhost' (Using password: NO) in /usr/local/apache/htdocs/submitform.php3 on line 7 Warning: -1 is not a MySQL link index in /usr/local/apache/htdocs/submitform.php3 on line 7 <--------ERROR MESSAGE STOPS HERE--------> Sorry for the massive email, but I'm very new to this, and I need all the help I can get... Thanks for reading... Sincerely, -- Trevor Penney, A+, Network+ Certified ---------------------- That's alright, I still got my guitar...

« previous php.general (#3301) next »