Connecting to your MySQL server via SSH can be very useful for developers and system admins and it is done in a very simple and efficient manner via SSH.
To do that follow these steps:
1. Log into your server as root via SSH 2. Run the following command
mysql -u db_username -p
When prompted to input the password, it will be the password for the username of that database that you are trying to connect to.
3. After entering the correct password, you will be greeted by the mysql welcome message and the mysql> command line.
Common commands are /h for help, /q for quitting and show databases; for a list of all of the databases for that particular user.