Create timestamped database backups

  • Applies to: Grid
    • Difficulty: Medium
    • Time: 10 minutes
    • Tools needed: SSH, Basic Command-Line Knowledge, VI or VIM


This article will walk you through how to create timestamped database back-up of your website on the Grid.

This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.


  1. Decide which database you want to back-up. I want to back-up a WordPress database called "dbXXXXX_dbname", for the website "".
  2. Log into SSH and enter your domain's document root.

    cd domains/
  3. Use VI or VIM to create a new file named '':

  4. Add the following information into the file, replacing the placeholders with your Grid & database username / password / name, and then save:

    cd ~/domains/
    mysqldump -h --add-drop-table -uXXXXX -pXXXXX dbXXXXX_dbname > database-backup-`date '+%Y.%m.%d'`.sql
  5. Run a command which will make the file executable by you, the owner:

    chmod 744
  6. Just to make sure it works, test it out:

    • If you entered the mysqldump command correctly, you should not see any error messages on the screen. To show that the command ran, when you perform a list directory command (ls), you should see a file called "", or whatever is the corresponding date. So now that we have a working script, it's time to make a regularly occurring job out of it.
  7. From inside the AccountCenter, choose the 'Admin' button and then click 'Cron Jobs'.
  8. Click the 'Add new cron job' button.
  9. Fill out the notification email field. This is important, so you are notified if the cron job fails.
  10. Fill out the "Command or script to execute" field with the full path to your backup. In this example, it will be:

  11. Choose what time you want the cron job to run. Since this will be a daily backup, you might want to specify 12:00am daily. Or perhaps you would rather back things up at 6:00pm, or at 8:45am; it is up to you.
  12. Once you are satisfied, press the save button.


Was this article helpful?
0 out of 0 found this helpful