我在cpanel托管中遇到数据库连接错误,代码如下;
<?php
$servername = "localhost";
$username = "helloDB";
$password = "MY_PASS";
$conn = mysqli_connect($servername, $username, $password);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
错误日志。。。
Connection failed: SQLSTATE[HY000] [2002] php_network_getaddresses:
getaddrinfo failed: Name or service not known
暂无答案!
目前还没有任何答案,快来回答吧!