SSH connection to MySQL

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.
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to run MTR to diagnose network issues

MTR is a network diagnostic tool that combines traceroute and ping utilities. It enables system...

Archiving and extracting with Tar & Gzip

Tar is the best tool to pack an archive and Gzip is the most widely used archive type when using...

Finding files via SSH

Finding files and content in the command line can be tricky sometimes, but with a bit know...

Using Putty to connect via SSH

Connecting to your Linux server via SSH is usually done via Putty at...

Using grep to search inside files

One very important tool that Unix provides is the grep command, which processes files line by...