1
Hey, guys, here’s my problem. I own my machine with a Mysql localhost, there is a website that I created, however, when I try to connect the DB of the site with another machine that is not connected to my WI-FI network or the error happens:
Warning: mysqli_connect(): (HY000/2002): An attempt to connect the failed because the connected component n answered correctly ap s a time per or the established connection failed because the host connected did not reply.
This error occurs only on external computers, even though everything works normal on my PC and others that are connected to my WI-FI network.
PHP connection of the site:
define('HOST', '192.168.1.244:3306');
define('USUARIO', 'monty');
define('SENHA', '[senha]');
define('DB', 'login');
$conexao = mysqli_connect(HOST, USUARIO, SENHA, DB) or die ('Não foi possivel conectar!');
mysqli_select_db($conexao, 'login') or die (mysql_error());
A few steps I’ve already taken:
=> Sql accounts have permissions to connect.
=> I already added the host account "%" for any ip.
=> Mysql’s my.ini bind address is IP 0.0.0.0
=> The IP I use in php connection is my ipv4.
=> I already allowed mysql and apache in the firewall, although it is turned off.
=> Apache and Mysql services are connected.
=> The login user of the php connection has global permissions.
=> I’ve already added the "Require all granted" lines to the httpd.xampp.conf file
Print of localhost accounts:
NOTE: All PHP code is being used in PHP Desktop and then converted into an executable by Inno Setup.
Anyway, thanks for your patience!
bind 127.0.0.1 would not be correct?
– ElvisP
– ElvisP
Also check, what really must be the problem, the ambiguity that the system listens to "localhost", if any, comment on one of them and test again.
– ElvisP
already released in the firewall access to this port ?
– Bulfaitelo
@Eliseub. I’m not sure but the bind 127.0.0.1, is only for local access and does not allow remote access from other machines
– Nithogg
@Eliseub. 1. Yes 2. No 3. I just added permissions so they can connect 4. I haven’t checked this yet
– Nithogg
@Eliseub. Sorry but how can I do this? I’m new with Mysql
– Nithogg
@Bulfaitelo Yes, even though the firewall is completely disabled
– Nithogg
Rotate this command
telnet ip_do_servidor 3306
and send me the result print.– Bulfaitelo
Do the test as suggested by Bulfaitelo and post the result
– ElvisP
@Bulfaitelo telnet 192.168.1.244 3306:
Y

 5.5.5-10.1.37-MariaDB*q}?bNB?áWwqQ!OJd8-u(mysql_native_password

Conexão ao host perdida.
– Nithogg
@Nithogg this test was done on a second machine on the same network ? or on the same server machine ?
– Bulfaitelo
@Bulfaitelo This was on the same server
– Nithogg
@Nithogg now does the same test on a machine on the same network.
– Bulfaitelo
@Bulfaitelo
Y
5.5.5-10.1.37-MariaDB);.t!Dp?á~_BheEeM2Q!Mmysql_native_password

Conexão ao host perdida.
– Nithogg
Before you continue the test, explain better where you are and this machine, it is outside your network ? or is on the same network (same ip range) ?
– Bulfaitelo
@Bulfaitelo The second test machine is a notebook that is connected on the same network and same host PC location. The IP of the second machine is practically equal to that of the main machine.
– Nithogg
Let’s go continue this discussion in chat.
– Bulfaitelo