How to Import MySQL Database via SSH

SSH, or Secure Shell, is a secure protocol for connecting to a remote server.

Requirements For Set-Up:
– Server IP Address
– SSH port
– SSH username
– SSH password

Application:

Linux:
Click Ctrl + Alt + T or Search → Terminal to run the terminal.

Mac OS:
In Spotlight search for Terminal.

Windows:
Download an SSH client that is suitable for you. I recommend PuTTY.

Format:
mysql -u databaseuser -p databasepassword databasename < mydatabase.sql

Basic SSH Commands
SSH – Command Explanation
ls – Show directory contents (list the names of files).
cd – Change Directory.
mkdir – Create a new folder (directory).
touch – Create a new file.
rm – Remove a file.
cat – Show contents of a file.
pwd – Show current directory (full path to where you are right now).
cp – Copy file/folder.
mv – Move file/folder.
grep – Search for a specific phrase in file/lines.
find – Search files and directories.
vi/nano – Text editors.
history – Show last 50 used commands.
clear – Clear the terminal screen.
tar – Create & Unpack compressed archives.
wget – Download files from the internet.
du – Get file size.