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. Searching for this for some time now – i guess luck is more advanced than search engines :)

  2. :) yeah… glad you finally found it.

  3. dispenses utilize a wonderful website decent Gives with thanks for the working hard to help people

  4. Thanks a lot for your feedback.

  5. Related SearchesLol stands forGuide to internet abb

  6. Dear admin, thnx for sharing this blog post. I found it wonderful. Best regards, Victoria…

  7. Thank you for your consideration Victoria, very appreciated .

  8. now see, this kind of stuff just does not make sense

  9. Kenia, what exactly does not make sense for you?

  10. I love your website! did you create this yourself or did you outsource it? Im looking for a blog design thats similar so thats the only reason I’m asking. Either way keep up the nice work I was impressed with your content really..

  11. Thank you … this is a wordpress blog powered by PHP and MySQL, is an open source CMS. Includes custom design templates, integrated statistics, automatic spam protection and others.

  12. I am a frequent reader of your blog posts. I liked the recent one and other posts on your blog so much that I have subscribed to the blog’s RSS feed in Thunderbird. Even thinking of stealing some ideas and put them to work. Keep all the good work going by posting more informative posts. Thank you. Time well spent on this post.

  13. @ Glady Vandenberg: Thank you so much for your consideration :)

  14. I found your site via yahoo thanks for the post. I will bookmark it for future reference. Thanks Investment mutual Fund

  15. I’m glad you found the information useful.

  16. I thought it was going to be some boring old post, but I’m glad I visited. I will post a link to this page on my blog. I am sure my visitors will find that very useful.

  17. I just wanted to comment and say that I really enjoyed reading your blog post here. It was very informative and I also digg the way you write! Keep it up and I’ll be back to read more in the future

  18. @ Bebe Neeson: Thank you for sharing my blog … I will post a link to your blog too. I’m glad that you like it.

  19. @ backlinks: Glad you find this post useful. Thanks a lot for your feedback.

  20. I am really thankful to the author of this post for making this lovely and informative article live here for us. We really appreciate ur effort. Keep up the good work. . . .

  21. Thanks a lot, this is all about sharing and improving …

  22. I found your site via google thanks for the post. I will bookmark it for future reference. Thanks Recycled Concrete is our specialty.

  23. I can’t but agree.I always wanted to write in my site something like that but I guess you’r faster.

  24. @ mortgage buyers: :) Yeah … I guess I am … this kind of scripts like AutoMySQLBackup must be shared, there are more than useful. I know the feeling when you are looking for something and you google it with no luck.

  25. Excellent post thanks!

    Sent via Blackberry

  26. I would like to begin by saying, thank you for supplying me with the information I’ve been searching for. I’ve been searching the internet for two hours looking for it and would have given my right arm if I would have found your website sooner. Not only did I find what I was looking for, but found answers to questions I never even thought to ask myself. Thank you for your wonderful web-site!

  27. This is a really good read for me, Must admit that you are one of the best bloggers I ever saw.Thanks for posting this informative article.

  28. I just wanted to comment your blog and say that I really enjoyed reading your blog post here. It was very informative and I also digg the way you write! Keep it up and I’ll be back to read more soon mate

  29. Usually I do not post on blogs, but I would like to say that this article really forced me to do so! Thanks, really nice article.

  30. Thanks a lot guys for your kind words, maybe you all can share this blog posts with others (post a link on your websites or just share)… I mean this is all sharing and improving – “Collecting data is only the first step toward wisdom but sharing data is the first step toward community (Linux 2006 33-40)”.

  31. Would like to AUTO the process of blog commenting ??

    “Do you need More Money, More Time, More Links, More Data?
    I will get to the point, Time is Money. We can’t create more hours in a day, BUT we can Automate Tasks so they take minutes rather than hours so we can get more done.”

    Now a tool to completely automate the process of posting comments is here. It’s called scrapebox, and it ain’t free. Scrapebox.com is charging 50sum dollars for it! Why pay, when you can get it free? Enjoy this software for FREE (for real)!! Download from the link Scrapebox v1.14.20 http://bit.ly/dsBBqz

    The proof that it works is this comment, it has been completely autposted. Have fun comment raping!

  32. Hi buddy, your blog’s design is simple and clean and i like it. Your blog posts are superb. Please keep them coming. Greets!!!

  33. It’s the first time I have heard that in Macedonia, obits are an unusual observe. You have wonderfully written the post. I have liked your way of writing this. Thanks for sharing this.

  34. I truly loved this brilliant article. Please continue this awesome work. Regards, Duyq.

  35. Hey there! Can easily I move your content in Pdf file file format? I definitely have it in my class.

  36. lolol where is a beer when you want one

  37. Aw, this was a really quality post. In theory I’d like to write like this too – taking time and real effort to make a good article… but what can I say… I procrastinate alot and never seem to get something done.

  38. @Kim Farmwald: Yes you can but please post a link to this blog also so everyone can share their opinion and maybe help others.

  39. @evony apply war ensign: As I said before this kind of posts and scripts must be shared! :) There are very useful.

  40. I just book marked your blog on Digg and StumbleUpon.I enjoy reading your commentaries.

  41. @Kredyty: Thank you … very appreciated!

  42. Thanks For This Post, was added to my bookmarks.

  43. Very Interesting Blog! Thank You For Thi Information!

  44. Great Blog! Saved it to my Bookmarks..

  45. You certainly have some agreeable opinions and views. Your blog provides a fresh look at the subject.

  46. Thanks guys for your feedbacks on this post :)

  47. Thanks For This Post, was added to my bookmarks.

  48. I just book marked your blog on Digg and StumbleUpon.I enjoy reading your commentaries.

  49. Just thought i would say hello and have a very nice day!!

  50. 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.

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>