Hi. I am having trouble with the mysql_connect function. When I try it I get the “Can’t get hostname for your address” error. I have enabled skip-name-resolve on my mySQL server, and I am positive this error has something to do with PHP, not the mySQL server because this works from the EasyPHP, but not my actual web server. Here are the details:
MySQL server:
OS: Windows 7
IP: 192.168.0.188
Port: 3306
Version: 5.5.8
skip-name-resolve is in the my.ini configuration file under [mysqld], as it should be.
remote connections are enabled, and work from other machines.
PHP connecting client:
OS: Ubuntu Server 10.04.3
IP: 192.168.0.198
Apache Version: 2.2.14
PHP version: 5.3.2-1ubuntu4.10 with Suhosin-Patch (cli)
Code:
[php]<?php
$con = mysql_connect(“192.168.0.188:3306”,“root”,“password”);
if (!$con)
{
die('Cant Connect: ’ . mysql_error());
}
?>[/php]
That code is saved in a .php file as test.php. When I visit it from my PC’s version of EasyPHP (5.3.8.0) everything works fine, but when I visit the same page when its hosted on my Ubuntu server, I get “Could not connect!: Can’t get hostname for your address”.