Backup

Back up your MySQL database regularly so you have a fallback point to which you can recover in the event you need to re-create your server, restore your server, or create a testing environment with data backed up from a live environment.

For example, let's say a natural disaster occurs, and all you have left is the MySQL backup file. You will be able to restore your MySQL database to the point at which the backup file was created. In reality, however, the MySQL database backup is used most frequently when an administrator has accidentally deleted their Admin Console tree view and needs to restore it rather than re-create it by hand.

A backup file contains maps, printer objects, drivers, profiles, portal header, and logs (for the Admin Audit Record report).

The testing environment is another common scenario in which the backup file plays an essential role. For example, let's say that you have changes you would like to test before you implement them in your production environment. Further, your testing environment requires data to run the tests properly. Instead of re-creating the data by hand, you can export your data from your live environment to a backup file, which you can then import into your testing environment.

The following steps show the backup procedures for a manual backup, which could be run for any number of reasons, and the automated backup, which is what you would use as the primary backup method for restoring PrinterLogic.


Manual Backup

  1. On the server running MySQL, open a command prompt as an administrator
  2. Type cd "c:\program files\mysql\MySQL Server <5.x or 8.x>\bin" to change directories.
  1. Type the following on a single line.
  2. mysqldump --user=[DBUser] --password=[DBPassword] --single-transaction --add-drop-database --databases [DBName] > c:\backup.sql

    The command shown above required the values for the following items: DBName, DBUser, and DBPassword. These values can be found at c:\inetpub\wwwroot\config\settings.php as shown in the following example. Keep in mind that you must remove the brackets surrounding DBName, DBUser, and DBPassword.

    The backup file will be saved to the location designated in the script above. In this case, the backup file is saved as c:\backup.sql and will be used for restoring the database on a new server, if necessary.

Automated Backup

Set up a Batch File

  1. On the primary PrinterLogic server, download and extract PrinterInstaller_Database_Export.bat.
  2. Open PrinterInstaller_Database_Export.bat in a text editor.
  3. Find password=<see settings.php> in the text as shown below.
  4. Replace <see settings.php> with the DB Password value from the settings.php file.
  5. The settings.php file is found, by default, in c:\inetpub\wwwroot\config. The DB Password appears as shown in the following example.

  6. Save the .bat file.

Automate the Database Export Using Windows Task Scheduler

  1. In the primary PrinterLogic server, open Windows Task Scheduler.
  2. Click Create Basic Task.
  3. In the Name field, type PrinterLogic Database Export.
  4. Click Next.
  5. In the Trigger tab, select Daily.
  6. Click Next.
  7. In the Daily tab, select the time of day that you want to export to occur.
  8. Click Next.
  9. In the Action tab, select Start a program.
  10. Click Next.
  11. In the Start a Program tab, click Browse.
  12. Navigate to the location where PrinterInstaller_Database_Export.bat is stored.
  13. Click Open.
  14. Click Next.
  15. In the Finish tab, select Open the Properties dialog for this task when I click Finish.
  16. Click Finish.
  17. When the PrinterLogic Database Export Properties (Local Computer) window appears, click Change User or Group.
  18. In the Enter the object name to select (examples): field, type System.
  19. Click OK.
  20. Click OK again.
  21. Close the Task Scheduler.