SQLSTATE[HY000] [2002] A connection attempt failed.. - When attempting to connect from Local to remote server
Hardly a surprise. The mysql socket is rarely if ever left open for connections from the public facing interface. usually mysql port (3306) can only be accessed from the private network interface.
Even if the socket was open, there are so many things that that go wrong including firewalls getting in the way and simple timeouts.