Question

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 where I want to connect to .nf.biz database :

$db=mysqli_connect($host,$user,$password,$db_name,3306);
Was it helpful?

Solution 5

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.

OTHER TIPS

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:

bind-address = 0.0.0.0

And comment out the following

#skip-networking

Finally restart MySQL.

Be careful with that, if your MySQL machine is accessible from public Internet will be accepting connections from everybody!

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 do not have the #skip-networking option.

I resolved it by hashing out the bind address line (See 3rd line below).

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.**
#bind-address       = 127.0.0.1

I solved just adding the port in bind-address like that: 127.0.0.1:3388

Go to services enable the service named after the root user (under the category "Log On As" -> Network Service)

I fixed this by setting the bind-address in my.cnf to the server's public IP address:

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = SERVER_IP_ADDRESS

This error occurs when the database is not responding.

I resolve this error by following steps:

  1. Press CTRL+R then type service.msc. A window opens.
  2. Check for MYSQL56 OR MYSQL57, click on that.
  3. NOW on the left bottom corner of the window. click on the expand.
  4. Again window refresh then u can see the start service option.
  5. click on that and the error resolve.

This works for me. hope your error is also resolved. mail me: rkkp1023@gmail.com

Using Wamp (php7) on Windows 10... It is currently working then it suddenly displayed that error. I restarted my laptop and the error is gone...

You have to start you service for the currently active mysql server, like mine was mysql80 so the following steps might help:

start> cmd>run as administrator> sc start mysql80

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:

bind-address = 0.0.0.0

And comment out the following

#skip-networking

Finally restart MySQL.

Be careful with that, if your MySQL machine is accessible from public Internet will be accepting connections from everybody!

sudo -s
sudo gedit /etc/mysql/my.cnf
bind-address = 0.0.0.0
#skip-networking
save
sudo service mysql restart

Worked perfect!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top