Secure-Shell (SSH) Reference Sheet – Database

This is the continuation of my Secure-Shell Reference Sheet – Basic.

Note: Anything surrounded by *asterisks* is where your input is required.

Accessing a Database

{code}mysql -u *username* -p *password* -h *hostname* *database*{/code}
This will log in directly

{code}mysql -u *username* -h *hostname* *database*{/code}
This will prompt you for the database user’s password
Continue reading Secure-Shell (SSH) Reference Sheet – Database

SSH Reference Sheet – Basic

SSH Reference Sheet – basic Secure-shell commands for every day use!

The more I work with SSH, the more I love it! Unfortunately, half the time I forget the commands. This is the first of a series of “Reference Sheets” to help myself and others learn/remember SSH commands.

Note: Anything surrounded by *asterisks* is where your input is required.

Change Directory

{code}cd *directory*{/code}

List the contents of a directory

{code}ls *directory*{/code}
Continue reading SSH Reference Sheet – Basic

Creating a SQL database (and user) through SSH

This is how you create a database and corresponding user through secure shell. I am taking from the point of being connected to your server through SSH. First you log into your sql database on your server.

Note: [username], [password], [hostname] and [database-name] are all place-holders. This is where you insert your credentials without the square brackets [ ].

{code}
mysql -u[username] -p[password] -h[hostname]
{/code}
Continue reading Creating a SQL database (and user) through SSH

Extracting a Single File/Folder from a .tar Ball

It’s actually quite simple! The standard un-tarring SSH line is:

{code}
tar -xzvf your-tar-ball.tgz
{/code}

You can target a specific file or folder by adding another parameter:

{code}
tar -zvxf your-tar-ball.tgz your-folder
tar -zvxf your-tar-ball.tgz your-folder/subfolder/image.jpg
{/code}

Note: The process will go through the entire tarball, so be patient!