How to connect to MySQL via SSH

How to connect to MySQL via SSH

Any hosting that has SSH access enabled can connect to MySQL via console. 
 
 
To do so, you must use the following command:
 
mysql -h ipweb -u databaseuser -p
 
-h: In this option, enter the web IP of the hosting. You can check the IP in the Server Information section of the cdmon Control Panel.
-u: In this option, enter the MySQL user. You can check these details in the MySQL section of the cdmon Control Panel.
-p: In this option, enter the MySQL password. You can check these details in the MySQL section of the cdmon Control Panel.
 
An example of using this command is the following:
 
servv739 [Thu Jun 27 11:05]# mysql -h 212.36.77.20 -u myuser894 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 160793
Server version: 5.0.51a-24+lenny1-log (Debian)
 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
 
For more information, you can contact us.