mysql:cpanel数据库连接php\u network\u getaddresses错误

dba5bblo  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(197)

我在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

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题