简体   繁体   English

MySQLI错误mysqli_connect

[英]MySQLI error mysqli_connect

Line number 7 returns this error: 第7行返回此错误:

php_network_getaddresses: getaddrinfo failed: No such host is known. php_network_getaddresses:getaddrinfo失败:未知此类主机。

<?php
define("HOST", "###"); // The host you want to connect to. 
define("USER", "###"); // The database username. 
define("PASSWORD", "###"); // The database password. 
define("DATABASE", "###"); // The database name. 

$dbconnect = new mysqli(HOST, USER, PASSWORD, DATABASE);
if($dbconnect->connect_error) {
    die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
}
mysqli_set_charset($dbconnect, "utf8_unicode_ci");
?>

That means that mysql can't connect to the host (mysql.hostinger.dk) for some reason. 这意味着mysql由于某种原因无法连接到主机(mysql.hostinger.dk)。 Make sure that you have the right address and that mysql is running on the server. 确保您具有正确的地址,并且mysql正在服务器上运行。

mysql.hostinger.dk can't be resolved to an IP. mysql.hostinger.dk无法解析为IP。

try doing ping mysql.hostinger.dk it should fail also 尝试做ping mysql.hostinger.dk它也应该失败

are you trying to connect to a remote mysql? 您是否要连接到远程mysql?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM