Jump to content

Cannot connect to remote MySQL system from within PHP.


Recommended Posts

Hi,

 

I have two NT 4 servers running on my home network, both have Apache installed, one \'asia\' has MySQL 3.23.49-max-nt-log, installed. I can connect from my main system \'echo\' to MySQL using a command window to connect via ODBC all set up several months ago via instructions in a book. All working OK (As I can see). I just lately discovered PHP and decided to add that to my Intranet to allow access to real data. To this end I updated all versions to the latest, Apache 2.0.43, and on the other server, \'isis\', I installed PHP 4.3.0. The Apache, PHP combination works OK.

 

The problem is when I come to connect to the remote DB I get nothing. It fails every time with no error message at all. I connected using the nodename \'asia\' with no joy so I tried the IP address.

$connection= mysql_connect(\"192.168.0.1\",\"sqlaccess\",\"password\");

It must connect and be rejected but I get no error nor a connection. If I try an invalid IP I get a long delay before a failure with no message again!!!.

 

It must be something simply because it\'s driving me loopy. Any ideas on where to look would be appreciated.

:D It was suggested I add a mysql_error() into my die statement which I didn\'t know you could do. I was calling it later when it had obviously been flushed. Anyway, it told me there was a password error which I played about with until it clicked. It was accessing the MySQL server from the other node \'isis\' not my client \'echo\' and I had different passwords on access for each. Changed the password in the connection statement to the one for \'isis\' and away it went.

 

Simple but still a pain.

 

Anyway sorted now. :D

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.