Quantcast
Channel: Web Applications – Jared Heinrichs
Viewing all articles
Browse latest Browse all 10

Windows – How to Backup MySQL using a Script

$
0
0

This post will cover how to easily backup your MySQL Database.

I typically use this script to backup my Databases. Rename the file to backup.bat

mysql_backup_Script

  • Lines 3&4 get the date and time. This time stamp will be added to the database backup files.
  • Line 7 sets up the variable bkupfilename that will be using
  • Line 11 – Enter your password in between the quotes.  The first time I used a really complex password there were some incompatible characters with the command line.
  • Line 16 – Deletes any file in the mysqldump folder that is older than 3 days.

Here is what the output looks like:

mysql_backup_Script_output

It’s nice that the password isn’t shown in the output. There were no files older than two 3 days in the folder so it didn’t have any files to delete.

*NOTE* – Do not put the script in the same folder as the database dumps. If you do after 3 days it too will be deleted!


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images