I’m sorry for the inconvenience you running into. However I can fairly safely say that Glitch is not blocking those outbound connections to your remote MySQL instance. I have a sample project running at https://glitch.com/edit/#!/mysql-connection-testing that basically uses all of the same code you’re using and is connecting successfully to a remote MySQL instance I have running, so you can take a look and verify that we’re connecting successfully - the results of the connection are rendered at https://mysql-connection-testing.glitch.me/.
It’s possible that your remote database host requires your source ip address to be whitelisted and that they might be blocking Glitch because your project’s IP address isn’t. I know I had to do that for my test. You can get the external IP address of your project’s host by opening the project’s console and running curl https://ifconfig.co/.