[DB-SIG] Cannot connect to Mysql DB when I try to start a Pyhonscript from PHP page.
dieter at handshake.de
Wed Jan 19 08:47:28 CET 2011
Watson Xu wrote at 2011-1-19 15:13 +0800:
>I added the port in code, the issue still there. BTW, this script works
>fine when I run it manually in Linux server.
>And it is strange that when I change "10.224.71.99" into "localhost".
>The issue is gone when I use the PHP page.
This, by itself, would indicate a configuration issue at the
MySQL server side: the server is listening at "localhost"
(i.e. "127.0.0.1") but not at "10.224.71.99".
Of course, this does not fit well with the other observation:
that the script works when you run the script manually.
Often, security problems are disguised (e.g. an authorization failure
could be masked as an "OperationalError"). I do not know whether
MySQL behaves like this. If it does, your observations might be
explained as follows:
The MySQL server has loose access restrictions for "localhost"
(all "localhost" users are trusted) but strict ones for "public"
interfaces. That could explain the second observation.
The MySQL server has loose access restrictions for local "normal"
users -- but strict ones for your user under which your
internet access operates.
To verify these assumptions, you could try to login as the user that
runs your webserver and as this user run the script (outside PHP).
Does the script still work?
More information about the DB-SIG