CHOOSE A REMOTE MYSQL CONNECTION METHOD
You can use either of the following methods to access your MySQL databases remotely:
- SSH tunnel: This is the more secure method. You set up an SSH tunnel that forwards a port on your local computer to the remote MySQL server. The MySQL traffic is encrypted by the SSH tunnel.
- Direct connection: You can set up a direct connection between your local computer and the remote MySQL server. Although it is easier to configure, it is not as secure.
After you have set up a remote MySQL connection, you can use a MySQL client application to manage your databases.
METHOD #1: SET UP AN SSH TUNNEL
The procedure you follow to set up an SSH tunnel between your local computer and the 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.Our 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:
- Start PuTTY.
- In the Category pane, expand Connection, expand SSH, and then click Tunnels.
- In the Source port text box of the Port Forwarding section, type 3306. This is the local port to forward.
Please note: If you are running a MySQL server on your local computer, you might have to change the port number of the local server (for example, to 3307) to avoid port conflicts. Alternatively, you can stop the local MySQL server to allow forwarding on port 3306.
- In the Destination text box, type localhost:3306.
- Confirm that the Local and Auto radio buttons are selected.
- In the Category pane, click Session.
- In the Host Name (or IP address) text box, type your web site's domain name or IP address.
- In the Port text box, type 7822.
- Confirm that the Connection type radio button is set to SSH.
- If a PuTTY security alert about the server's host key appears, click
- When the login as prompt appears, type your A2 Hosting username, and then type your password.
- 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.
Please note: 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:
- Open a terminal window and type the following command at the command line. Replace username with your A2 Hosting username, and example.com with your site's domain name:
ssh -p 7822 email@example.com -L 3306:localhost:3306
The number before localhost is the port number at the local end of the tunnel. The number after localhost is the port number at the remote (server) end of the tunnel. If you are running a MySQL server on your local computer, you might have to change the first 3306 to another port number (for example, 3307) to avoid port conflicts.
- Type your password, and then press ENTER. 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.
METHOD #2: SET UP A DIRECT CONNECTION
To set up a direct connection between your local computer and the MySQL server, you must enable remote MySQL access in cPanel.
To view the online documentation for PuTTY, please visit http://the.earth.li/~sgtatham/putty/0.60/htmldoc/index.html.