0

I am using following code to connect to remote mysql from php application I am using WAMP server where i installed my php application and on remote side also wamp server is there.

$con=mysql_connect('xxxx:xxxx:xxxx:xxxx','root','');

But connection is not being established. Following warning is coming...

Warning: mysql_connect() [function.mysql-connect]: [2002] php_network_getaddresses: getaddrinfo failed: No such host is known. (trying to connect via tcp://10:133)

Please any body give me some idea ! thanks !

John Woo
  • 258,903
  • 69
  • 498
  • 492
Rakesh Ray
  • 29
  • 2
  • 5

3 Answers3

3

Should be dots not colons, like


$con=mysql_connect('xxxx.xxxx.xxxx.xxxx','root','');
//like
$con=mysql_connect('127.0.0.1','root','');

Sudhir Bastakoti
  • 99,167
  • 15
  • 158
  • 162
2

Use dots in your IP address, not colons.

blankabout
  • 2,597
  • 2
  • 18
  • 29
1

try this:

$con=mysql_connect('192.168.0.1','root','');

or if you want to specify the port:

$con=mysql_connect('192.168.0.1:3306','root','');
John Woo
  • 258,903
  • 69
  • 498
  • 492
  • thanks a lot !Request is going. I had missed that one. Now following warning is coming ........... Warning: mysql_connect() [function.mysql-connect]: Host 'rakesh-PC' is not allowed to connect to this MySQL server in C:\wamp\www\jquery\jphp\jsontest.php on line 18 – Rakesh Ray Mar 11 '12 at 06:53
  • The problem is that the MySQL server doesn't allow access from all external sources (e.g. could be only a select few, or even no external sources at all). – John Woo Mar 11 '12 at 07:25
  • try to read this article: http://stackoverflow.com/questions/5367493/how-to-connect-to-mysql-on-host-on-another-computer-on-network – John Woo Mar 11 '12 at 07:28
  • Your MySQL server is blocking your connection. – Alex Mar 11 '12 at 10:06