开发者

MySQL remote connection problem "system error: 111"

开发者 https://www.devze.com 2023-03-17 15:14 出处:网络
I have a mysql server installed on windows 2003 machine.Whe开发者_Go百科n I try to connect to this server remotely with PHP, it gives \"system error: 111\" error, but when I try to connect using commm

I have a mysql server installed on windows 2003 machine. Whe开发者_Go百科n I try to connect to this server remotely with PHP, it gives "system error: 111" error, but when I try to connect using commmand prompt or using mysqlyog, it always connects.

works well this command

mysql -h 192.168.0.10 -u root

and here is the php code

<?
    session_start();
    $PHPSESSID = session_id();

        define("DB_SERVER", "192.168.0.10");
    define("STOCK_DB", "stock");
    define("MASTER_DB", "masterstock");
    define("DB_USERNAME", "root");
    define("DB_PASSWORD", "");
    define("DB_PREFIX", "mlc");

        function makeconnection()
        {
                $link = mysql_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD);
                if (!$link) 
                {
                        die('Error while connecting to MySQL : ' . mysql_error());
                }

                $db = mysql_select_db(MASTER_DB, $link);

                if (!$db)
                {
                        die ('Can\'t Open Database : ' . mysql_error());
                }
        }

?>      

*Edit: Please note, I am able to connect locally, able to connect remotely using command prompt *

Any help.


I contacted the hosting, and they fixed it. Actually, port 3306 going outbound was not open


Make sure your firewall is not blocking the port.

0

精彩评论

暂无评论...
验证码 换一张
取 消