This article describes how to use a local computer to connect to your MySQL databases stored remotely on A2 Hosting servers.
You can use either of the following methods to access your MySQL databases remotely:
After you have set up a remote MySQL connection, you can use a MySQL client application to manage your databases. For more information, please see this article.
The procedure you follow to set up an SSH tunnel between your local computer and the A2 Hosting server depends on the local computer's operating system.
In order to use an SSH tunnel on a computer running Microsoft Windows, you need an SSH client program. A2 Hosting recommends using PuTTY, which you can download here. After you have downloaded the PuTTY executable to your local computer, you can set up an SSH tunnel.
To set up an SSH tunnel on a computer running Microsoft Windows:
When the remote server's command line prompt appears, the SSH tunnel is established and you can use your MySQL client applications on the local computer.
To verify that PuTTY is forwarding ports correctly, you can click the icon in the top-left corner of the PuTTY session window, and then click Event Log. If port forwarding is working correctly, you see a line similar to:
Local port 3306 forwarding to localhost:3306
To establish an SSH tunnel on a computer running Mac OS X or Linux:
ssh -p 7822 firstname.lastname@example.org -L 3306:localhost:3306
To set up a direct connection between your local computer and the MySQL server, you must enable remote MySQL access in cPanel. For information about how to do this, please see this article.
The following procedure demonstrates how to configure a remote ODBC connection:
To test the connection, click
If you are doing development work on the local computer, a local copy of MySQL may already be running on port 3306. In this case, the following connection error appears:
To work around this issue, create a tunnel with an alternate local port, and then connect to the remote MySQL server on that port.
The session configuration does not change.
For Mac OS X or Linux, use the following SSH command to create the tunnel with a local port of 3307. Replace username with your A2 Hosting username, and replace example.com with your site's domain name:
ssh -p 7822 email@example.com -L 3307:localhost:3306
Create the ODBC connection as previously described, but type 3307 in the Port text box (instead of 3306).
To view the online documentation for PuTTY, please visit http://the.earth.li/~sgtatham/putty/0.60/htmldoc/index.html.
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.