How to backup MySQL on Attix5 Server Edition for Windows

To backup a MySQL database in Windows requires the user to dump a copy of the database first using the mysqldump utility. The Attix5 SE client software will then backup this dump file.

Windows Setup

  1. Install the Script plug-in using the Attix5 plug-in installer installed found on the Downloads page.
  2. Create a directory where the dump file will be dumped to, eg c:\MySQLdump\
  3. Create a batch file using Notepad. Copy/paste the following:

    mysqldump --opt -h hostname -u user --password=password database > C:\MySQLdump\testdump.sql

    Note: you will need to change hostname, user, password and database to the correct parameters for your database. Ensure that this command is on one line only.
  4. Save this notepad file to your Attix5 Pro\Backup Client SE\ installation directory as a ".bat" file (not .txt). In This example we have used A5MySQLDump.bat
  5. Test the script by opening a Windows command line prompt. Navigate to the location where you saved the script, enter the name of the script and press Enter. The script should dump the database to the c:\MySQLdump folder. If it does not, check the error and fix any spelling issues. 
  6. Open Attix5 SE client and go to Tools, Plugins, Scripting.
  7. Click Add to add a new script.

    Backup Script

  8. Enter a name for the script and set the script to run on "Backup Start".
  9. In the "Execute" field, enter the full path of the script.
  10. In the "Execute in folder" field, enter the path of the mysqldump executable file - usually the "bin" directory of the MySQL folder.
  11. Tick "Wait for process to complete" checkbox and tick "Abort backup if exit code is not 0". Click Ok and Ok again to return to the user interface.
  12. In the selection tree, select the folder for backup that you created the dump file. In our example it was c:\MySQLdump\
  13. Click "Backup" to start the backup process.

The database should then be dumped to the specified folder and this folder should be backed up. The most common errors are spelling mistakes in the script for the username, database and password.

Once the backup has completed, run a restore on this dump file testdump.sql and ensure that you can successfully restore it to a test database.

  • Attached Files
  • windowsscript.jpg (41.95 KB) 1430