Skip to main content

How to backup MySQL on Azure Database?

Please use the following steps to backup MySQL databases using AhsayOBM on Azure Database using Linux CLI.

Create backup set

  1. Login to your OBM user account via the AhsayCBS web management console.
  2. Go to User.
  3. Open Backup Sets.
  4. Click the [+] sign to create a new backup set.
  5. To proceed, check the names of the databases you aim to backup first.
    • You may use a utility like MySQL Workbench.
      1. Open MySQL.
      2. Click the "+" button to setup new connection.
      3. Enter credentials to connect to MySQL.
      4. Once connected, click Data Export under Management section to see list of databases.
    • Or use Linux CLI.
      1. Login as root to the Linux CLI machine using an SSH client.
      2. Go to the bin directory (or a directory where MySQL utilities are located).
      3. Connect to the MySQL server using this command: mysql -h [server_ip_address] -u [username] -p
      4. Enter the password.
      5. After successful access, enter "show databases"
  6. Ater confirming the databases, go back to your AhsayCBS web management console.
  7. Change the backup set type to MySQL Backup.
  8. Rename the file backup set.
  9. Select Linux for platform.
  10. Scroll and select Azure Database for Host Type.
  11. Enter the MySQL instance ID for the host name.
  12. You may keep the Port value on default or change it accordingly if your MySQL database instance is setup using a different port.
  13. Proceed with the login ID and password, then click Next.
  14. Under Other selected source, click the [+] button to add a backup source.
  15. Manually enter the directory path of each database you intent to backup. Click the [+] to continue.
  16. Repeat the same step if you intend to add other sources as well.
  17. Click Next to continue.
  18. Enter the host name to use the computer name for the scheduler.
  19. You may use the default schedule provided or create a new one.
  20. Click Next.
  21. Click the [+] button to add a new storage destination and select your preferred destination.
  22. Click the [+] button again.
  23. Leave the backup mode on Sequential.
  24. Click Save.

Configure the settings before running backup job

  1. Click on the backup set.
  2. Recommended: Open Retention Policy and enable Simple retention policy for 3690 days.
  3. Click Others and configure the Temporary Directory.
  4. Leave Compressions on default. Encryption key will be set up on Linux CLI.
  5. Scroll down and enable File Viewer.
  6. Click Save.

Set up the encryption key

  1. Login as root to the Linux backup machine using an SSH client.
  2. Use the cd command to go to bin: cd /usr/local/obm/bin
  3. Open AhsayOBM to setup the encryption key: sh RunConfigurator.sh
  4. Enter 1 to login.
  5. Enter the login name and password.
  6. Enter Y to setup the encryption key of your backup set.
  7. Enter Y again to confirm.
  8. Enter 1 to select Default.
  9. Enter 8 to quit

Run the backup job

  1. Use the sh command to run the backup job: sh RunBackupSet.sh '[backup set name]'
  2. After the backup job, a line will indicate Backup Completed Successfully.

Check the backed up databases from File Viewer

  1. Open File Viewer and reload the page.
  2. Select the backup set.
  3. Click on the MySQL folder to see all the databases backed up.