Command line instructions for ssh and mysql

A quick and very basic list of commands to get you started with command line.

If you need to know how to log in to ssh with command line and manage a database you can follow the instructions below. You will find how to import a database with command line, how to export it and how to drop it. There are also some other quick tips if you are working with WordPress.

I use this step-by-step to manage Wordpress sites and their relative database.

Log in to ssh


Drop old database
Delete the existing DB

mysqladmin -u your_username -p drop database_name

Create database

mysqladmin -u your_username -p create database_name

Import database

mysql –h my_sql_host –u my_slq_username –p my_sql_dbname < dbname.sql

Update .htaccess file and make it writable

Go to root folder then type: -be careful when changing permissions

touch .htaccess
chmod 666 .htaccess

Export a database

mysqldump -h my_sql_host -u my_slq_username -p my_sql_dbname > dbname.sql

Copy a database to Desktop
log out of ssh

scp ~/Desktop

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s