Sunday 31 July 2016

PHP -MySQL:No connection could be made







I tried to connect mysql database.but am getting the following error.





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




test.php:



$link = mysql_connect(localhost, dbuser, dbpass);
if (!$link) {

die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...