|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Remote MySQL connection problem
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 at all. 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 simple because it's driving me loopy. Any ideas on where to look would be appreciated. |
|
#2
|
|||
|
|||
|
RE: Remote MySQL connection problem
Try:
Code:
$connection= mysql_connect("192.168.0.1","sqlaccess","password") or die(mysql_error());
|
|
#3
|
|||
|
|||
|
RE: Remote MySQL connection problem
Tried that.
Instant response. Return is null and it dies and no messages displayed, excluding the die of course. I also removed the die to see if that would give me more information and added echo "Return = '$connection'" Displayed was; Return = '' |
|
#4
|
|||
|
|||
|
RE: Remote MySQL connection problem
How do you know it isn't connecting?
|
|
#5
|
|||
|
|||
|
RE: Remote MySQL connection problem
Forgot to add the sql_error within the die. Silly me! It said I had a password problem when I added it in like you suggested. Mmmm. I'll have another look at the passwords and that.
Thanks. A step forward. |
|
#6
|
|||
|
|||
|
RE: Remote MySQL connection problem
Brut, Progress...... It's now working thanks for your help. Getting the error message out allowed me to sort it.
I had entered the user 'sqlaccess' and a password and used the code I have used on my remote web site which works OK. Where it failed with no displayed error message. However, it was accessing the MySQL server from the other node 'isis' and not my client PC 'echo' which I had a different password for sqlaccess on. The link was working but with the wrong password and with no error messages I did not have a clue. I did not know about putting the mysql_error() in the die() and that was the way forward. I will remember that from now on. Brut, Thanks again for your help it is much appreciated. |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Remote MySQL connection problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|