I know there are many people already asked this , but this people mostly forgot password of blocked by firewall which i have none of this situations .
i am developing with php , and i need to connect to remote database to let all my team work on it .
localhost was just going fine , but when i tried to switch it gave me this error
No connection could be made because the target machine actively refused it.
and this is my code
i want to connect to .nf.biz database
$db=mysqli_connect($host,$user,$password,$db_name,3306);
thanks erverone
Even if this is not your case, I will add the answer here, because the message for this bug is the same.
There is a bug in MySQL server when you have some alias for localhost in c:\Windows\System32\Drivers\etc\hosts, MySQL server is unable to accept connection to localhost.
Remove the alias and MySQL Server will start to accept connections to localhost.
I solved just adding the port in bind-address like that: 127.0.0.1:3388
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.
This error occurs when the database is not responding.
I resolve this error by following steps:
This works for me. hope your error is also resolved. mail me: rkkp1023@gmail.com
I do not have the #skip-networking option.
I resolved it by hashing out the bind address line (See 3rd line below).
Your MySQL server is only accepting connections on *nix socket (
/var/run/mysqld/mysqld.sock
if you're running Ubuntu) or for localhost only.You have to edit your
my.cnf
(on Ubuntu again is located in/etc/mysql/my.cnf
) and change the following:And comment out the following
Finally restart MySQL.
Be careful with that, if your MySQL machine is accessible from public Internet will be accepting connections from everybody!
Worked perfect!