There is a computer and laptop in the same network through the router. Nout wi-fi, PC - directly cable from the router. See each other, all the rules. On the laptop there is a database whose data is constantly changing, so you need to connect to it from a PC. Through Navicat added a new user user@192.168.0.86 (client ip) with all rights (global previlegas). Now on the PC (client) I make a request to connect to the database with the indication of the host - Ip laptop in the end I get:

Warning: mysql_connect (): An attempt to establish a connection was unsuccessful, because The required response was not received from the other computer within the required time, or the already established connection was terminated due to the incorrect response of the already connected computer.

PHP code:

define('DB_HOST','192.168.0.46'); define('DB_USER','user'); define('DB_NAME','db_name'); define('DB_PAS','password'); $dbh=mysql_connect(DB_HOST,DB_USER,DB_PAS) or die(mysql_error()); mysql_query('SET NAMES utf8'); mysql_select_db(DB_NAME); 

Can someone tell me what else needs to be done? Why not come?

issue resolved with firewall blocking and my.ini settings.

  • access to the database exactly? Try telnet 192.168.0.46 3306. 3306 is the default port for the base, if changed, you also need to change it. - koks_rs
  • the second problem - user@192.168.0.46 is needed - where it connects, not from where. - Alexey Prisyazhny
  • Sori for such a question, but where to register telnet? I register in com.string and I am informed that Telnet is not an internal command. Ports everywhere under MySql 3306. user@192.168.0.46 - as I understand it here Ip - This is who connects, not where (where - because we are now on the server), according to the manual webew.ru/articles/414.webew - Maxim
  • What operating systems do your computers run on? is the mysqld configuration indicated to listen on all network interfaces? Are network connections blocked by firewalls on your computers? - aleksandr barakin
  • alexander barakin, the same OS W7, and you can find out details about viewing the configuration of network interfaces and blocking network connections with a firewall? - Maxim

1 answer 1

If the MySQL server is pinged, then most likely the port is closed by firewall / antivirus