错误:SQLSTATE[HY000] [2002] 无法建立连接,因为目标计算机主动拒绝它
调试代码时突然发生错误。它具有有关与数据库的连接的一系列错误。
ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it.
( ! ) Fatal error: Uncaught exception 'PDOException' with message ' in C:\wamp\www\web\main\users.php on line 15
( ! ) PDOException: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. in C:\wamp\www\web\main\users.php on line 15
这是错误指向位置的代码
function __construct()
{
$this->con = new PDO("mysql:host=".$this->host.";dbname=".$this->db,$this->user,$this->pass);
}
我不知道该怎么办,因为我通常不会遇到这样的问题,所以我没有对WAMP进行过太多研究。感谢您的帮助。