Mysqli_Connect(): (Hy000/2002): No Connection Could Be Made Because the Target MAChine Actively Refused It

mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it

If you look at your XAMPP Control Panel, it's clearly stated that the port to the MySQL server is 3306 - you provided 3360. The 3306 is default, and thus doesn't need to be specified. Even so, the 5th parameter of mysqli_connect() is the port, which is where it should be specified.

You could just remove the port specification altogether, as you're using the default port, making it

$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$db = 'test_db13';

References

  • mysqli_connect()
  • Standard connection of MySQL

when I start apache MySQL server, I get error (HY000/2002): No connection could be made because the target machine actively refused it.

Add below line under config.inc.php

$cfg['Servers'][$i]['port'] = 8111;

arning: mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it

Since you are using wampp. try go command line on the bin folder with mysql.exe file. Test are you able to connect to that server in the first place.

mysql -uroot -h 192.168.1.### -P 3306 -p

-uroot -u is indicate user name. root is the user name to login your mysql server. Just change the root to correct user name.

Possibility
1. Remote server did not open for remote mysql connection.
2. Remote server firewall is not open the Mysql port for remote connection.
3. You have attempt too many time with wrong password. So now your IP is been blacklist by the MySQL server itself.

ERROR: SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it

If the WAMP icon is Orange then one of the services has not started.

In your case it looks like MySQL has not started as you are getting the message that indicates there is no server running and therefore listening for requests.

Look at the mysql log and if that tells you nothing look at the Windows event log, in the Windows -> Applications section. Error messages in there are pretty good at identifying the cause of MySQL failing to start.

Sometimes this is caused by a my.ini file from another install being picked up by WAMPServers MySQL, normally in the \windows or \windows\system32 folders. Do a search for 'my.ini' and 'my.cnf' and if you find one of these anywhere outside of the \wamp.... folder structure then delete it, or at least rename it so it wont be found. Then restart the MySQL service.

Mysql No connection could be made because the target machine actively refused it

Well this might be late but for future visitors,

I found out back then that biz.nf refuses any connections to it's DB from outside source which means that only the web-apps hosted on biz.nf have the access to their DB other than that you will get rejected.



Related Topics



Leave a reply



Submit