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

I know that many people have already asked about this, but these people basically forgot the password blocked by the firewall, which I do not have in any of these situations.

I am developing with php and I need to connect to a remote database so that my whole team works on it.

localhost just went fine, but when I tried to switch, it gave me this error

The connection could not be established because the target computer was actively rejecting it.

and this is my code where I want to connect to the .nf.biz database:

$db=mysqli_connect($host,$user,$password,$db_name,3306);
+7
source share
10

, , ,

, biz.nf , , -, biz.nf, , , .

+1

MySQL * nix socket (/var/run/mysqld/mysqld.sock, Ubuntu) .

my.cnf( Ubuntu /etc/mysql/my.cnf) :

bind-address = 0.0.0.0

#skip-networking

, MySQL.

, MySQL , !

+12

, , .

MySQL , localhost c:\Windows\System32\Drivers\etc\hosts, MySQL localhost.

, MySQL Server localhost.

+4

I # skip-networking.

(. 3- ).

# 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
+2

bind-: 127.0.0.1:3388

+2

, my.cnf IP-:

# 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
0

, .

, :

  • CTRL + R, service.msc. .
  • MYSQL56 MYSQL57, .
  • . .
  • , .
  • .

. , . mail me: rkkp1023@gmail.com

0

Wamp (php7) Windows 10... , . , ...

0

mysql, mysql80, :

start> cmd>run as administrator> sc start mysql80
-1

MySQL * nix- (/var/run/mysqld/mysqld.sock, Ubuntu) .

my.cnf ( Ubuntu /etc/mysql/my.cnf) :

bind-address = 0.0.0.0

#skip-networking

, MySQL.

Be careful if your MySQL machine is accessible from the public Internet, a connection from everyone will be accepted!

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

Worked great!

-2
source

Source: https://habr.com/ru/post/1534071/


All Articles