One Click Automatic Backup All Your MySQL Database in zip format on Windows | windows

It is not uncommon that web developers find themselves in a DBA role at some point in their career. A basic but crucial DBA responsibility is taking backups of the database. I often need to make a quick backup of MySQL database. For most database work I use phpMyAdmin. I do this because troubleshooting database issues are far outside of my skill-set and I need to get stuff done regardless of that. There are some situations when phpMyAdmin is not an ideal solution to take backups. Like migrating to a new system or taking a complete backup of your old projects databases or you may want to make the periodic backup of databases.

MySQL provides us the tool required to do this: mysqldump. As the name implies, this can make a dump of one database or even to all the databases. Based on the fact that we need to backup all the databases. We can use the following code to dump MySQL databases on the Windows command prompt.

Let's Find Out How to Backup MySQL Database in Windows

How to Use Windows MySQL Backup Script

  1. Make sure your computer has a Zip compression application. I have used 7-zip best free open source file compression software.
  2. Make sure to change the path (from line 4-9) based on your WAMP or XAMP setup.
  3. Next, you will need to create a *.bat file (using notepad). Open up notepad and copy and paste the script below.
  4. You will also require to changing the dbUser, dbPassword, backupDir, mysqldump, mysqlDataDir and zip file/app locations.
  5. Save the file as mysqlbackup.bat or any-filename.bat
  6. Before running this script make sure your MySQL is running.
  7. This is a executable file. Now left click and "Run As Administrator".

Post a Comment

Previous Post Next Post