How to connect to remote MySQL server with sshuser and mysqluser being distinct I'm trying to connect to a remote MySQL server via ssh so that I have write-access to export some data. At the moment I can do the following:


Connect to the remote MySQL using mysql -u mysqluser -pPASSWORD -h HOSTIP DATABASENAME
Connect to the machine using ssh sshuser@HOSTIP


(Note that HOSTIP is the same for ssh and mysql server, but mysqluser and sshuser are different).

However, I cannot connect to remote MySQL via ssh. I tried two things:


After ssh-ing into the machine, I tried mysql in the terminal but it is not installed.
I tried ssh -L 1234:mysqlhost:3306 sshuser@sshhost. However, I can only enter my sshpassword, after which I get ssh-ed in but no connection to MySQL still.
First you need to do SSH user@serveripaddress then click enter you will be prompting to enter password. please enter the same.

After that use mysql -u root -p then click enter you need to enter mysql password. If mysql is not installed in your server. Please install then get root password from DBA and then try.