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.
- Install the Script plug-in using the Attix5 plug-in installer installed found on the Downloads page.
- Create a directory where the dump file will be dumped to, eg c:\MySQLdump\
- 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.
- 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
- 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.
- Open Attix5 SE client and go to Tools, Plugins, Scripting.
- Click Add to add a new script.
- Enter a name for the script and set the script to run on "Backup Start".
- In the "Execute" field, enter the full path of the script.
- In the "Execute in folder" field, enter the path of the mysqldump executable file - usually the "bin" directory of the MySQL folder.
- 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.
- In the selection tree, select the folder for backup that you created the dump file. In our example it was c:\MySQLdump\
- 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.