Page 1 of 2

db connecting from everyelse except from the website.

Posted: Tue Jun 08, 2004 1:33 pm
by anjanesh
// 101:101:0:50 is NOT the real ip.
There are 2 servers for this : 1 has the php scripts and the other has the mysql db. So I tried to connect to the mysql db by giving the ip.

Code: Select all

$con=mysql_connect('101:101:0:50','news','skdgh31') or die("Cannot Connect");
But it always gave Cannot Connect.
phpMyAdmin was available at 101:101:0:50:8000 and everything worked OK.
I used MySQL front and it too connected.
Yet my scripts from this site could not connect ?
If someone here replies that the problem lies in the php then please mention what I have to look for in phpinof() ?
Please help. Thanks.
Anjanesh

Posted: Tue Jun 08, 2004 1:54 pm
by feyd
changing 'die("Cannot Connect");' to 'die(mysql_error());', what does that kick out?

Posted: Tue Jun 08, 2004 2:33 pm
by anjanesh
Can't connect to MySQL server on 'xxx.xxx.xx.xxx' (10060)

Posted: Tue Jun 08, 2004 2:39 pm
by Buddha443556
Why the semicolons in the IP address?

Posted: Tue Jun 08, 2004 2:43 pm
by anjanesh
semicolons ? This exactly how the ouput appeared

Posted: Tue Jun 08, 2004 2:46 pm
by Buddha443556
Try

xxx.xxx.xxx.xxx

the semicolon is used to indicate the port like

xxx.xxx.xxx.xxx:n

[edit]
Sorry I mean colon. My eyes aren't what they use to be.

Posted: Tue Jun 08, 2004 3:01 pm
by anjanesh
That colon(port) is sued ONLY to access the phpMyAdmin. The IP without port is for direct connection to db.

Posted: Tue Jun 08, 2004 3:06 pm
by Weirdan
what buddha was talking about is:
anjanesh wrote:

Code: Select all

$con=mysql_connect('101:101:0:50','news','skdgh31') or die("Cannot Connect");
Have you tried to change colons to dots here?

Re: db connecting from everyelse except from the website.

Posted: Tue Jun 08, 2004 3:07 pm
by Buddha443556
anjanesh wrote:

Code: Select all

$con=mysql_connect('101:101:0:50','news','skdgh31') or die("Cannot Connect");
Those are three colons? My guess is they're confusing PHP since it does recognize the port in the server arguement.

Code: Select all

$con=mysql_connect('101.101.0.50','news','skdgh31') or die("Cannot Connect");

Posted: Tue Jun 08, 2004 3:09 pm
by anjanesh
Same error. So its not a problem with the port

Posted: Tue Jun 08, 2004 3:13 pm
by anjanesh
Sorry - there was no colon in the code. I mistyped it in here only.
xxx.xxx.xx.xxx does not work
xxx.xxx.xx.xxx:xxxx does not either

Posted: Tue Jun 08, 2004 3:16 pm
by anjanesh
This is all there is in the phpinfo.

MySQL Support enabled
Active Persistent Links 0
Active Links 0
Client API version 3.23.49

Directive Local Value Master Value
mysql.allow_persistent On On
mysql.connect_timeout -1 -1
mysql.default_host no value no value
mysql.default_password no value no value
mysql.default_port no value no value
mysql.default_socket no value no value
mysql.default_user no value no value
mysql.max_links Unlimited Unlimited
mysql.max_persistent Unlimited Unlimited
mysql.trace_mode Off Off


If there is anything left out that needs to be present please mention. I don;t know abt this but shouln't the ip of the mysql server be present here ?

Posted: Tue Jun 08, 2004 3:18 pm
by Buddha443556
Might this pertain to your situation:
I have some problems using MySql in Windows XP Home (don't ask why WXP Home, I'm going to linux next weekend), when using php or mysqlcc I get the message [paredes_yedra] ERROR 2003: Can't connect to MySQL server on 'paredes_yedra' (10060) and I'm trying to set up MySql without network connection it was a really pain.
Check first the my.ini and uncomment the #bind-address 127.0.0.1 and it works.
Don't reinstall mysql.
found that in the comments here: http://dev.mysql.com/doc/mysql/en/Can_n ... erver.html

Posted: Tue Jun 08, 2004 3:25 pm
by anjanesh
When I run on my local machine connecting to the mysql db - it works. So its not a prob with the mysql db server. But when I uploaded it to the website (different ip so localhost cannot be used for connectivity) it does not connect. So connection is not the prob the script in the wesite connecting to it is.

Posted: Tue Jun 08, 2004 3:32 pm
by Weirdan
Are you sure there are no firewall issues? Try 'telnet xxx.xxx.xxx.xxx xxxx' on your webhost (you need shell access for that), where dot-delimited Xs stand for ip and last Xs are the port number used to connect to mysql db.