External MySQL connections on our cPanel servers

Although there is “possibility” to allow external MySQL client connections to hostingaccounts under our cPanel server services, those are blocked on server level by default! However there is workaround to still use external connections for MySQL:

1. Under Windows OS
2. Under Unix/Linux/MacOS OS
3. MySQL Workbench

1. Under Windows OS

Under windows machines there is sadly no out-of-box solution for SSH connection. However one might use a program called PuTTY for that!
Instructions how to create SSH tunnel with PuTTY for MySQL: http://realprogrammers.com/how_to/set_up_an_ssh_tunnel_with_putty.html
How to use Putty under Windows OS: https://kb.radicenter.eu/KB1512#win
NB! Under cPanel server authenticatinc with main account password via SSH is not possible. You can only access SSH via authorized keypairs! Generated publikkey via PuTTY should be added/imported under Security -> SSH in cPanel and authorize it on the same page!

After that You can use command on Your localmachine commandline for “remote” MySQL access:

mysql -h 127.0.0.1 -u DBUSERNAME -p DBNAME

2. Under Unix/Linux/MacOS OS

To generate needed keypairs for authentication etc:
https://kb.radicenter.eu/KB1512#linux
NB! Under cPanel server authenticatinc with main account password via SSH is not possible. You can only access SSH via authorized keypairs! Generated publikkey via PuTTY should be added/imported under Security -> SSH in cPanel and authorize it on the same page!

To create SSH tunnel please use command (after checking that privatekey is indeed in needed folder!):

ssh -L 127.0.0.1:3306:cpX.radicenter.eu:3306 npXXXX -N

(where cpX is Your cpanel server name (cpa/cpb/…) and npXXXX is Your webhosting account main username)
After that You can use command on Your localmachine commandline for “remote” MySQL access:

mysql -h 127.0.0.1 -u DBUSERNAME -p DBNAME

3. MySQL Workbench

MySQL workbench is free software to manage MySQL/MariaDB servers/databases for Windows/Linux/MacOS. You can download it from:
https://dev.mysql.com/downloads/workbench/
Instructions how to create SSH tunnel for “remote” MySQL authentication can be found on page: https://dev.mysql.com/doc/workbench/en/wb-mysql-connections-methods-ssh.html

Comments are currently closed.