Bug #23323 Apache/2.2.2 cannot connect to remote MySQL Server
Submitted: 16 Oct 2006 7:05 Modified: 16 Oct 2006 8:47
Reporter: Moby Kwong Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.22 OS:Linux (FC5)
Assigned to: CPU Architecture:Any

[16 Oct 2006 7:05] Moby Kwong
Description:
I have a PHP program that connect to localhost MySQL Server and a remote MySQL Server.

When I use command mode to call the program (php DataConnector.php) 
or use MySQL Administrator to open the connection, both the localhost and remote server can be connected.

But when I call it by Apache (http://localhost/DataConnector.php), only the localhost can be open. And the following is kept in the /etc/httpd/logs/error_log:

[Mon Oct 16 13:34:39 2006] [error] [client 127.0.0.1] PHP Warning:  mysql_connect() [<a href='function.mysql-connect'>function.mysql-connect</a>]: Can't connect to MySQL server on 'xxx.xxx.xxx.xx' (13) in /var/www/html/DataConnector.php on line 48

How to repeat:
you can call this by command mode and by browser to see the difference.
<?php

class DataConnector{

	public function __construct(){

	
	if(!mysql_connect('localhost','xxx','xxx')){

			die('Could not connect to the core system database!');

		}

if(!$this->conArr[$counter]=mysql_connect('xxx.xxx.xxx.xxx:3306','xxx','xxx')){

	die($server['ip'].':3306'.'xxx'.'xxx');

}

else echo 'success';

	}

}

$test=new DataConnector();

 ?>
[16 Oct 2006 8:47] Valeriy Kravchuk
We're sorry, but the bug system is not the appropriate forum for asking help on using MySQL products. Your problem is not the result of a bug.

Support on using our products is available both free in our forums at http://forums.mysql.com/ and for a reasonable fee direct from our skilled support engineers at http://www.mysql.com/support/

Error 13 is a "permission denied" problem. Read http://dev.mysql.com/doc/refman/5.0/en/access-denied.html and http://dev.mysql.com/doc/refman/5.0/en/privileges.html for the details.

Thank you for your interest in MySQL.