Home arrow MySQL arrow Page 2 - MySQL in SSH: Basic Guide

Connecting to MySQL Server using the Putty SSH Client - MySQL

There are some hosting companies that do not offer an SSL (Secure Socket Layer) environment for MySQL. It is important to have an SSL environment for MySQL, because your sessions are protected with “encryption.” Fortunately, if you can't get SSL with your hosting company, there is an alternative: SSH.

  1. MySQL in SSH: Basic Guide
  2. Connecting to MySQL Server using the Putty SSH Client
  3. Basic MySQL Database and Table Commands in SSH
  4. Creating a New MySQL Table and Configuration
By: Codex-M
Rating: starstarstarstarstar / 5
May 03, 2010

print this article



Let's start with the very basic: connecting to your MySQL server using SSH. When you connect using SSH, you need a client. One of the most recommended SSH client is Putty

This works for Windows. If you use Linux, Putty will run using the same set of SSH commands, but with a different installer (using its Linux version).

It is very important that you make sure you have SSH enabled for your website hosting. If you do not, then you will never be able to communicate with your MySQL server in SSH.

To connect to your MySQL server:

Step 1: Launch Putty.

Step 2: In the Putty Configuration, you will need to basically enter the following required information:

Host Name: {hostname of your FTP server, NOT MySQL server}

Port: {the port required to connect to SSH; some hosting companies may NOT use the default port 22, so you need to check with them}.

Connection Type: SSH


Step 3: Once all are set, click "Open."

Step 4: You are then required to enter your SSH user name (this is still NOT your MySQL user name). You can get your SSH access from your web host.

Step 5: Once you have entered your user name, Putty will ask you to enter your password, which you will need to type blindly.

Step 6: Your connection with your hosting SSH server is successful if you do not see password warning errors, and you do see the SSH prompt (example):


This prompt is different on other web hosting companies offering SSH, but it should end with $ sign.

Step 7: In the prompt, you enter you MySQL login credentials. For example, if you have the following fictitious login:

MySQL hostname: pdb3.alienwebhosting.com

MySQL username: codexm

MySQL password: interstellarguy

You will enter it in the prompt as:

-bash-2.06b$ mysql -hpdb3.alienwebhosting.com -ucodexm -pinterstellarguy

The red bolded words in the syntax are the MySQL login details. The syntax for the MySQL command line login is:

-bash-2.06b$ mysql -hHOSTNAME -uUSERNAME -pPASSWORD

Step 8. If you see the MySQL command prompt after entering the login details in Step 7:


Then you have successfully logged in and connected to your MySQL server using SSH.

>>> More MySQL Articles          >>> More By Codex-M

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Oracle Unveils MySQL 5.6
- MySQL Vulnerabilities Threaten Databases
- MySQL Cloud Options Expand with Google Cloud...
- MySQL 5.6 Prepped to Handle Demanding Web Use
- ScaleBase Service Virtualizes MySQL Databases
- Oracle Unveils MySQL Conversion Tools
- Akiban Opens Database Software for MySQL Use...
- Oracle Fixes MySQL Bug
- MySQL Databases Vulnerable to Password Hack
- MySQL: Overview of the ALTER TABLE Statement
- MySQL: How to Use the GRANT Statement
- MySQL: Creating, Listing, and Removing Datab...
- MySQL: Create, Show, and Describe Database T...
- MySQL Data and Table Types
- McAfee Releases Audit Plugin for MySQL Users

Developer Shed Affiliates


Dev Shed Tutorial Topics: