Here’s how you can connect to MySQL on Amazon EC2 from Linux / Mac without opening any port by forwarding your local port over SSH
linux
Enable remote access to MySQL database
Usually remote access to MySQL database is disabled for security reasons. However, if you need to provide remote access to MySQL, just follow these steps.