Rakesh Ray
Rakesh Ray

Reputation: 29

using IP address connect to mysql

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 !

Upvotes: 0

Views: 10136

Answers (3)

John Woo
John Woo

Reputation: 263683

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','');

Upvotes: 1

Sudhir Bastakoti
Sudhir Bastakoti

Reputation: 100175

Should be dots not colons, like


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

Upvotes: 3

blankabout
blankabout

Reputation: 2627

Use dots in your IP address, not colons.

Upvotes: 2

Related Questions