Daily/weekly/monthly Mysql database backup with cron

Smart Mysql database backup with cron
Create and assign a DB user to the DB you want to backup with all privileges from your Cpanel >> Mysql section.
following is a simple script to take backup using cron. Just create the file, chmod it to 750 and execute it using cron.


/usr/bin/mysqldump –user=db_User –password=xyz –databases db_name | gzip > /home/foo/db_name-`date “+%Y%m%d%H%M”`.sql.gz


db_user is your database user who has access on your database.
db_name is the database name you are scheduling backup for.
xyz is the actual password of above database user.
+%Y%m%d%H%M is the time stamp which will help to distinguish between backup date and time.
the backup destination in above example is “/home/foo/”

add following line in cron to take backup everyday at 23:00 and will store in separate file

0 23 * * * /PathToScript.sh

Security notes Note ::
1) Dont use the command directly in cron. Put the command in a file and execute that file in cron.
2) I asked to chmod to 750 so that other will not be able to view your files.
If the file is readable by others anyone may view it and get your DB access very easily.

Be Sociable, Share!

399 thoughts on “Daily/weekly/monthly Mysql database backup with cron”

  1. I¡¦ll immediately snatch your rss feed as I can’t to find your e-mail subscription link or newsletter service. Do you have any? Kindly let me recognise so that I could subscribe. Thanks.

  2. You really make it seem really easy along with your presentation however I to find this topic to be really one thing that I believe I would never understand. It sort of feels too complicated and very extensive for me. I’m having a look ahead for your next put up, I will attempt to get the cling of it!

  3. We are a group of volunteers and opening a new scheme in our community. Your web site provided us with valuable info to work on. You have done a formidable job and our entire community will be grateful to you.

  4. Hiya, I am really glad I have found this info. Today bloggers publish just about gossips and web and this is really annoying. A good blog with exciting content, this is what I need. Thank you for keeping this website, I will be visiting it. Do you do newsletters? Cant find it.

  5. Attractive section of content. I just stumbled upon your blog and in accession capital to assert that I acquire in fact enjoyed account your blog posts. Any way I’ll be subscribing to your augment and even I achievement you access consistently rapidly.

  6. Great post. I was checking continuously this blog and I’m impressed! Very helpful information specially the last part :) I care for such information a lot. I was seeking this particular information for a very long time. Thank you and best of luck.

  7. I simply couldn’t go away your web site before suggesting that I really loved the standard information an individual supply in your guests? Is gonna be back frequently to check out new posts

  8. You could certainly see your enthusiasm within the paintings you write. The arena hopes for even more passionate writers such as you who aren’t afraid to mention how they believe. All the time follow your heart.

  9. You’ll find it nearly unattainable to see well-aware men and women on this area, however, you look like you fully understand whatever you’re writing on! Many Thanks

  10. It¡¦s really a great and useful piece of information. I¡¦m satisfied that you shared this helpful information with us. Please keep us up to date like this. Thanks for sharing.

  11. My brother suggested I might like this website. He was totally right. This post truly made my day. You cann’t imagine simply how much time I had spent for this info! Thanks!

  12. Somebody essentially help to make significantly posts I might state. This is the first time I frequented your web page and thus far? I amazed with the research you made to make this actual put up incredible. Magnificent job!

  13. you’re really a excellent webmaster. The site loading speed is incredible. It kind of feels that you are doing any unique trick. In addition, The contents are masterpiece. you have performed a fantastic task in this topic!

  14. My Partner And I just need to advise you that I’m just fresh to blogging and thoroughly liked your site. Very likely I am likely to save your article post . You indeed have fabulous article reports. Delight In it for share-out with us your url information.

  15. I do agree with all of the ideas you’ve introduced on your post. They are very convincing and can certainly work. Nonetheless, the posts are very brief for beginners. May you please extend them a bit from next time? Thanks for the post.

  16. Thank you for another informative site. The place else could I get that kind of information written in such an ideal manner? I have a mission that I’m simply now running on, and I’ve been at the look out for such info.

  17. I leave a response each time I like a article on a site or if I have something
    to valuable to contribute to the discussion. It is triggered
    by the sincerness displayed in the article I read.

    And after this article Daily/weekly/monthly Mysql
    database backup with cron | RegencyHost Blog. I was moved enough to post a comment :-)
    I actually do have 2 questions for you if it’s okay.

    Could it be just me or does it look as if like a few of
    the remarks appear as if they are written by brain dead individuals?
    😛 And, if you are posting on other places, I would like to keep up with everything fresh you have to post.

    Could you make a list all of your communal sites like your linkedin profile,
    Facebook page or twitter feed?

  18. We’re a group of volunteers and starting a new scheme in our community.

    Your website provided us with valuable info to work on.
    You have done an impressive job and our entire community will
    be thankful to you.

  19. What you published made a lot of sense. However, what about this?
    suppose you were to create a awesome post title? I mean, I don’t
    wish to tell you how to run your blog, however what if
    you added a title that grabbed a person’s attention? I mean Daily/weekly/monthly Mysql database backup with cron | RegencyHost Blog is kinda boring.
    You ought to look at Yahoo’s home page and see how they write article titles to grab viewers to open the links.
    You might add a related video or a related picture
    or two to get people excited about what you’ve written. In my opinion,
    it could bring your posts a little bit more interesting.

  20. I think that everything said made a great deal of
    sense. However, what about this? what if you were to create a killer title?

    I am not suggesting your information is not solid., however
    suppose you added a headline that makes people desire more?
    I mean Daily/weekly/monthly Mysql database backup with cron | RegencyHost Blog is
    a little plain. You should glance at Yahoo’s
    front page and note how they create news headlines to grab people to click.
    You might add a related video or a related pic or
    two to get people interested about everything’ve written. In my opinion,
    it would make your posts a little livelier.

  21. Hey very cool website!! Man .. Excellent .. Superb ..
    I will bookmark your website and take the feeds additionally?
    I am glad to search out so many useful info right
    here in the publish, we need develop extra strategies
    on this regard, thank you for sharing. . .

    . . .

  22. Proactol is also used as remedy for aches and pains. Now removing that stubborn fat
    from your body is easy with the Zerona Fort Lauderdale.
    After eight it’s too late, avoid late night dinner.

  23. I was suggested this web site by way of my cousin. I’m no longer positive whether or not this
    submit is written through him as no one else realize such certain approximately my problem.
    You’re wonderful! Thank you!

  24. Hi there! I could have sworn I’ve been to this blog before
    but after browsing through a few of the posts I realized it’s new to me.
    Regardless, I’m definitely pleased I found it and I’ll be book-marking it and
    checking back often!

  25. Hi excellent website! Does running a blog similar to this require a large amount of
    work? I’ve no understanding of programming however I had been hoping
    to start my own blog soon. Anyhow, if you have any recommendations or
    tips for new blog owners please share. I understand this is off subject but I just needed to ask.
    Appreciate it!

  26. Thank you a lot for sharing this with all people you actually understand what you’re speaking approximately!

    Bookmarked. Please also seek advice from my site =). We will have a
    hyperlink exchange agreement among us

  27. When it’s about the games, they ask from the player more intense involvement with the story that takes place
    in real. Jon Smith is a writer and is interested in topics related to Tech – Wench.
    With the advent of Smartphones like Android, online
    education has been surpassed with rapid development in mobile apps development.

  28. Keep control of the ball while it is behind your back. You could even find some astonishing quality of
    articles related to those stars and pros of the basketball game.

    The tournament takes 3 weeks, and the national semifinals, which are called
    the Final Four, have become a sporting event that is extremely popular.

  29. They also make you stylish and trendy and thus help to
    boost your self confidence. We have done all the hard work for you and carefully chosen the finest i – Phone games that
    are absolutely free of charge. There are a number of them, which you can find at this Cheatcc page, but we will list a few together with how to unlock them.

  30. Users can also shop game saves, Psn Card Generator downloads and
    personal media about the cards. A Play – Station network card, allows you
    to buy products and items from online retailers of Play – Station that
    you can freely use if you have a PSN Code Generator card.
    The Internet is a place where people can have lots of fun.

  31. Cristiano Ronaldo was named the greatest football player
    in the world as he won the FIFA Ballon d’Or award for 2013
    at the FIFA Gala ceremony in Zurich on Monday (January 13, 2014).

    As the world’s football governing body, the world
    cup is organized by FIFA (Federation Internationale
    de Football Association) and it features the male counterparts of the football teams of every
    member nation of FIFA. If you haven’t been playing such games,
    you are missing out on all the fun.

Leave a Reply

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

Connect with Facebook

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=""> <s> <strike> <strong>