[DB-SIG] Cannot connect to Mysql DB when I try to start a Pyhon script from PHP page.

Dieter Maurer dieter at handshake.de
Wed Jan 19 07:47:58 CET 2011


Watson Xu wrote at 2011-1-18 10:20 +0800:
>I created a PHP page and one Python script. Please see the following in
>blue for the PHP source code and the Python script. When I launch the
>PHP page in IE to start the python script, the python script give me the
>error information shown as blow, please see the following error
>information in yellow. Could you give me some suggestions for it? Thanks
>a lot!
> ...
>Python Script (/var/www/html/test.py):
>--------------------
> ...
>import MySQLdb
>
>MySQLdbHost="yyy.yyy.yyy.yyy"
>MySQLdbUser="yyy"
>MySQLdbPassword="yyy"
>MydbSID="yyy"
>MydbPort=3306
> ...
>Myconn=MySQLdb.connect(host=MySQLdbHost, user=MySQLdbUser,
>passwd=MySQLdbPassword, db=MydbSID, port=MydbPort)
> ...
>    super(Connection, self).__init__(*args, **kwargs2)
>
>_mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL
>server on '10.224.71.99' (13)")

Your problem is neither on the PHP nor the Python side.

Instead, it lies with the MySQL connection parameters.
Apparently, there is no MySQL at port "3306" at host "10.224.71.99"
or it refuses to speak with this client.



--
Dieter


More information about the DB-SIG mailing list