How to remotely connect to a MySQL database located on our shared server

Remote MySQL connection is disabled on our shared servers due to security reasons, but you can easily set up an SSH tunnel between your computer and our server using an SSH client with the MySQL port 3306 forwarding.

After completing it you will have port 3306 on your local machine listening and forwarding to your remote server's localhost on port 3306. Thus, you can connect to the remote server's MySQL database effectively as though it was running on your local box.

Below you can find the steps on configuring a third-party SSH client, PuTTY, and MacOS and Linux built-in one - Terminal.

Follow the steps below to connect with PuTTY

1. Run the application. 

2. In the Sessions tab fill out your server hostname or IP-address and port 21098: 

putty3.png

3. Switch to the tab Tunnels in the 'SSH' section. 

4. Put 3306 as Source port and 127.0.0.1:3306 as Destination

putty1.png

5. Click on the Add button.

6. Return to Session tab and click on Save.

7. Go ahead and run your session by clicking on the Open button: 

putty3.png

8. Run your MySQL software on a local machine and use 127.0.0.1 as a server host, port 3306 and your database user login details. 


Please find below the steps to connect with Terminal

1. Run the application and enter the following command: 

ssh -f cPanel_username@server_hostname -p21098 -L 3306:localhost:3306 -N 

Make sure to replace cPanel_username with your actual cPanel account user. 

2. Hit Enter and specify your cPanel password (symbols won’t appear in the terminal when you type in the password - it is a terminal way of keeping your password secure): 



3. Once done, all connections to localhost over the port 3306 will be forwarded to your hosting account. 


That's it!

  • 26 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Vezani članci

How can I monitor what my MySQL server is doing?

A handy little Linux application called mytop fits this just perfectly. This is a near-time...

How do I backup MySQL in Linux?

1. Copying from the mysql directoryBy default, MySQL databases on servers that use Linux are...

How to install Mysql

How to install Mysql Via RPM : Please check the following link and get RPM...

How to reset a mySQL password?

If you have lost your root user password for MySQL, you can reset it with the following...

Mysql Basic Commands

[mysql dir]/bin/mysql -h hostname -u root -p Create a database on the sql server. create database...

Powered by WHMCompleteSolution