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
Export a database using gzip
{code}mysqldump -u *username* -p *password* -h *hostname* *database* | gzip > *database*.sql.gz{/code}
Import a database using gzip
{code}gzip -d < *database*.sql.gz | mysql -u *username* -p *password* -h *hostname* *database*{/code}
If you have any other commands you wish me to include, leave a comment below!