22. June 2010 · 79 comments · Categories: Linux

A Simple Database Backup:

You can use mysqldump to create a simple backup of your database using the following syntax.

mysqldump -u [username] -p [password] [databasename] > [backupfile.sql]

  • [username] – this is your database username
  • [password] – this is the password for your database
  • [databasename] – the name of your database
  • [backupfile.sql] – the file to which the backup should be written.

The resultant dump file will contain all the SQL statements needed to create the table and populate the table in a new database server. To backup your database ‘Data’ with the username ‘pensacola’ and password ‘password’ to a file customdata.sql, you would issue the command:

[pensacola@pensacola-tech ~]#mysqldump -u pensacola -p password Data > customdata.sql

Import your data into your database:

[pensacola@pensacola-tech ~]# mysqldump -u pensacola -p password Data < customdata.sql

Backup of Mysql database using phpMyAdmin:

It is assumed that you have phpMyAdmin installed since a lot of web service providers use it.

  • Open phpMyAdmin.
  • Click Export in the Menu to get to where you can backup you MySql database. Image showing the export menu.
  • Make sure that you have selected to export your entire database, and not just one table. There should be as many tables in the export list as showing under the database name.
  • Select”SQL”-> for output format, Check “Structure” and “Add AUTO_INCREMENT” value. Check “Enclose table and field name with backquotes”. Check “DATA”, check use “hexadecimal for binary field”. Export type set to “INSERT”.
  • Check “Save as file”, do not change the file name, use compression if you want. Then click “GO” to download the backup file.

Restoring a backup of a MySql database with phpMyAdmin:

  • To restore a database, you click the SQL tab.
  • On the “SQL”-page , unclick the show query here again.
  • Browse to your backup of the database.
  • Click Go.


There is a script to take daily, weekly and monthly backups of your MySQL databases using mysqldump. You can download this script from here. This can be run using the following:

[pensacola@pensacola-tech ~]#sh automysqlbackup.sh.2.5

This is a very simple way for server administrator …

If you find AutoMySQLBackup valuable please make a donation at:


  1. I find myself coming to your blog more and more often to the point where my visits are almost daily now!

  2. Very Interesting Blog! Thank You For Thi Blog!

  3. I just sent this post to a bunch of my friends as I agree with most of what you’re saying here and the way you’ve presented it is awesome.

  4. Awesome Blog. I add this Post to my bookmarks.

  5. I’ve been visiting your blog for a while now and I always find a gem in your new posts. Thanks for sharing.

  6. Very informative post. Thanks for taking the time to share your view with us.

  7. Very interesting information. Thanks for sharing.

  8. Great blog! I truly love how it is easy on my eyes as well as the information is well written. I am wondering how I might be notified whenever a new post has been made. I have subscribed to your rss feed which really should do the trick! Have a nice day!

  9. We are a group of volunteers and starting a new scheme in our neighborhood. Your blog provided us with valuable information to help us get started|.You have done a great job!

  10. Heya?-my very first comment on your site. ,I have been reading your blog for a while and thought I would completely pop in and drop a friendly note. . It is great stuff indeed. I also wanted to ask..is there a way to subscribe to your site via email?

  11. your post is useful to me,i have add to my bookmark.

  12. I am publishing a new blog related to this subject.I need the RSS feed of your site to have some matter from your website.Can you please give me of the RSS feed of your blog.The feed you will provide will contain link back to your blog,so you can also get backlink from my site,notify me at “vikas.kumar” (yahoo id)

  13. I added a link to this site on my blog! can you add a link of my blog to your site

  14. Awesome article! thanks for the good read!

  15. Well, this is my make curb minus in place of your webpage! We¡¯re a group of volunteers and commencing a kind supplemental initiative in a community in the identical niche. Your weblog offered us profitable data to charge on. You obtain done a splendid craft!

  16. Thank you very much for this awesome blog post; this is the kind of thing that keeps me going through the day. I’ve been looking around for this site after I heard about them from a mate and was thrilled when I was able to find it after looking for some time. Being an avid blogger, I’m pleased to see others taking initiative and contributing to the community. I just wanted to comment to show my appreciation for your work as it’s very encouraging, and many bloggers do not get the credit they deserve. I’m sure I’ll be back and will send some of my friends.

  17. This is a definitely useful blog. Many thanks for sharing! I have put your RSS feed into my web site.fast student loans

  18. We were was doing some research and impressed by the info you wrote. Read exactly what I needed also. Please write more.

  19. I just sent this post to a bunch of my friends as I agree with most of what you’re saying here and the way you’ve presented it is awesome.

  20. hey there, this might be little offtopic, but i am hosting my site on hostgator and they will suspend my hosting in 4days, so i would like to ask you which hosting do you use or recommend?

  21. @James: Of course that I recommend Pensacola Tech solution for your website. If you are interested you can send an e-mail to office@pensacola-tech.com with your request and our team will contact you . Best regards, Pensacola Tech team.

  22. Im not going to going to say what everyone else has already said , but i must say ,Your are truly well-informed.I cant believe how much of this I just wasnt aware of .Thank you for publishing more information to this topic for me .Im truly grateful and really impressed.

  23. Pretty good information, could be enhanced further

  24. good day, I attempted to e-mail you pertaining to this post but aren’t able to reach you. Please message me when get a moment. Thanks.

  25. @Gregory Despain : Please send me a message at office@pensacola-tech.com and I will respond.

  26. Hi there could I quote some of the information found in this post if I link back to you?

  27. @Stephenie Geving: Yes , sure

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>