gpt4 book ai didi

php - 无法使用 mysql_* API 建立连接

转载 作者:可可西里 更新时间:2023-11-01 07:47:46 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select

我尝试连接 mysql 数据库。但出现以下错误。

Warning: mysql_connect(): [2002] No connection could be made because the target machine actively (trying to connect via tcp://localhost:3306) in test.php on line 5

Warning: mysql_connect(): No connection could be made because the target machine actively refused it. in test.php on line 5 Warning: mysql_close() expects parameter 1 to be resource, boolean given in test.php on line 15

测试.php:

<?php
$link = mysql_connect(localhost, dbuser, dbpass);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com