远程数据库 - MySQL连接错误

时间:2015-11-26 06:09:32

标签: php mysql mysqli

我在通过mysqli_connect连接到远程数据库时遇到警告..它在与SQLYog连接时正在工作

 Warning: mysqli_connect(): (HY000/2002): A connection attempt failed because 
 the connected party did not properly respond after a period of time, or 
 established connection failed because connected host has failed to respond.
 in C:\xampp\htdocs\connect\connect.php on line 9

代码::

$hostname="xxx.xx.xx.xx"; 
$username="xxxx"; 
$password="xxxx"; 
$database="xxxx"; 
$port = 3306;

$link = mysqli_connect($hostname, $username, $password, $database, $port); 
if (!$link) { 
    die('Connection failed'); 
}  

0 个答案:

没有答案