Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1045035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:55:28+00:00 2026-05-16T15:55:28+00:00

I have a pretty large db in MySql, and I need to take backups

  • 0

I have a pretty large db in MySql, and I need to take backups of it every day or so.

I need to be able to take backups from any computer, so therefore I thought about making a php script to do this and put this php script online (offcourse with password protection and authorization etc so that only I can access it).

I wonder however, how is this done properly?

What commands should I use, and is it possible to change settings of the backup (for instance Add AUTO_INCREMENT value = true)?

I would appreciate examples…

Also, if this is a bad method (unsafe, or maybe gives bad backups with bad sql files), what other method would be preferred?
I have shell-access and I have a VPS (ubuntu server).

My Mysql version is 5.1

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:55:29+00:00Added an answer on May 16, 2026 at 3:55 pm

    There’s no need to involve PHP in the database backup. You just need a script that uses mysqldump to backup the database, and setup a CRON job to periodically execute the script:

    mysqldump db_name > backup-file.sql
    

    …will backup your database to a file, by redirecting the output from the mysqldump to the specified file name.

    Peter brought up a good point, that the command would only give you one day of archiving–any archive over two days old would be overwritten. This would allow you have a rolling log going back seven days:

    CURRENT_DAY_OF_WEEK=`date '+%u'`
    FILENAME="mysqlbackup_"$CURRENT_DAY_OF_WEEK".sql"
    
    mysqldump db_name > $FILENAME
    

    Also be aware that file permissions will apply – can’t write a file if the user executing the script doesn’t have permissions to the folder.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pretty large site and every page is built from several included
I have a pretty large form to develop and it could take some time
I'm looking at building a Rails application which will have some pretty large tables
I have a bunch of pretty large CSV (comma separated values) files and I
I have a pretty large social network type site I have working on for
I have a pretty large insert statement something like INSERT INTO multimedia (filename, regex,
I have a pretty large resource dictionary and I was wondering if there was
I am working on this site, and I have a pretty large .css document.
I have the following query: SELECT location, step, COUNT(*), AVG(foo), YEAR(start), MONTH(start), DAY(start) FROM
We have pretty large files, the order of 1-1.5 GB combined (mostly log files)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.