How to connect to 5gbfree hosting?
I am unfamiliar with 5gbfree hosting, but the host = localhost for me is a clear indication that the host may not be accesible from the public internet, only the application server will have access.

Check if you can change the database server and network configuration/firewall, but I would strongly suggest to, asuming you have ssh remote access or similar to tunnelize the mysql connection (e.g. https://stackoverflow.com/questions/22639188/how-can-i-use-ssh-tunneling-to-connect-to-a-remote-mysql-server ) so you don't expose the mysql service to the outside, but still can access from your development machine.

If tunnelizing or opening ports are not options, consider setting up a local test database on your development machine instead rather than connecting directly to the one on your hosted environment or installing web administration tools such as phpmyadmin. Free hosting services are, for a reason, not very flexible. If you want to test mysql but cannot afford to pay for it I would suggest taking advantage of the 1 year free of limited hosting on AWS and the free accounts of RDS and EC2.