Mysql dump a backup using terminal & ssh/ shell

May 15, 2009

I decided today to take a backup of a database in the usual way using phpmyadmins export facility. I exported it to a zip file and called it i then ftp'd it to the location on the server i wanted.

I then decided that i wanted to mysqldump this database using the terminal, which ive never done before but which is much quicker and more reliable than using phpmyadmins built in import function.

So here we go.................

Step 1 :   Unzip the file that you ftp'd to the server which contains your backup database


Step 2:   Login into your mysql database using terminal

       mysql -u mysql_username -p

Step 3:   You will be prompted for your password for mysql, enter it and hit enter, note(you will not see any characters going in).

Step 4:   Enter the database name that you want to add the backup into or create a new database

Step 5 (optional): Create a database from command line

       mysqladmin create db_name

Step 6:   Once the table is there select the table:

       use db_name

Step 7:   Once the table is there select the table:


Step 8:  then simply quit out of the mysql console using


Step 9:  For help using the mysql console:


I hope someone finds this useful, its very simple and can save loads of time.

About me

Hello! I'm David Heward, how are you going? I'm a Senior Devops/Build Engineer, specialising in AWS & Cloud Automation. Based in London. Strong 10+ year background in Software development. Have a read of my blog. Have a look at some of my working projects. Contact me at @davehewy or on Linkedin.