0

Really strange problem and i do not found working solution for hours. My Desktop-Setup (WinPc, XAMPP, Win7) is working great. My Laptop-Setup (MacBook, XAMPP, MacOs10.12) is not.

I try to connect to an external MySQL(i) Database from php.

I tried MAMP and XAMPP and always get the same solution. Connecting to the local Database Server (localhost) via php is working fine.

If i try to connect to external mysql-database, webbrowser is freezing - after a while I get a TIME OUT.

Warning: mysqli::mysqli(): (HY000/2002): Operation timed out in Fatal error: Failed to connecto to MySQLi: Operation timed out in

I guess the problem is somewhere at the mysql or the macOS, but i don't know where to search or what is blocking.

I can ping/telnet the remote host and i get answer. The same script (same database login data) is working on the pc/windows machine.

There is no problem with the remote database server. I can connect from windows machine and also i can connect from mac with the database tool "db beaver". But I cant´t connect via php.

SOLUTION: maybe the many installs from MAMP and XAMPP did anything to the osx. Reinstall from XAMPP and reboot did fix everything.

killphil75
  • 16
  • 2
  • have you checked your database connection settings? It could be either your end or remote db settings – Atilla Arda Açıkgöz Aug 03 '17 at 12:02
  • the php script is working on the win-machine / same network. and I can also telnet the remote database host from terminal and get answer. >> mysql_native_passwordConnection closed by foreign host. – killphil75 Aug 03 '17 at 12:06
  • you can check this post, it might be helpful. I guess you need to configure for remote access. https://superuser.com/questions/591901/telnet-fails-to-connect-connection-closed-by-foreign-host – Atilla Arda Açıkgöz Aug 03 '17 at 12:11
  • Also this is helpful if your problem is with remote access privileges https://stackoverflow.com/questions/8348506/grant-remote-access-of-mysql-database-from-any-ip-address – Atilla Arda Açıkgöz Aug 03 '17 at 12:13
  • well, as mentioned above. I can connect to the remote database with the same db settings from the win machine (same php skript) and also from the macbook with a tool called "DB beaver". So the data and configurations are correct. But the access from php fails with timeout. (access to a local database is working fine). I checked the XAMPP error logs, but find no information "what failed". – killphil75 Aug 03 '17 at 12:27
  • i'm glad you figured out. – Atilla Arda Açıkgöz Aug 03 '17 at 12:58

0 Answers0