< All Topics

How to Backup Your Koha Database

1. Open the Terminal

Access your server terminal either directly or via SSH. Ensure you have administrative access to the MySQL (or MariaDB) database associated with your Koha installation.

2. Run the Backup Command

Use the following command to create a compressed backup of your Koha database:

mysqldump -u [username] -p [name_of_koha_db] | gzip -c > [backupname].gz

Explanation of the components:

  • -u [username]: Your MySQL or Koha database username.

  • -p: Prompts you for the password after pressing enter.

  • [name_of_koha_db]: Your Koha instance’s database name (e.g., koha_library).

  • | gzip -c: Compresses the SQL dump using gzip to save space.

  • [backupname].gz: Specifies the name of your backup file. Use a descriptive name such as koha_library_2025-06-03.gz.

  •  

💡 Tip: To find your Koha database name, run:

mysql -u root -p
show databases;

3. Verify the Backup

Once the command completes, check that the backup file was created by listing the contents of the current directory:

ls -lh

You should see a .gz file with the name you specified. This file contains all your bibliographic, patron, and circulation data and can be restored into any Koha installation if needed.

 

Next Steps

  • Store the backup file in a secure location (e.g., Amazon S3, an external drive, or another server).

  • Consider setting up a cron job or using AWS Backup tools for automated daily backups.

Launch Your Library Into The Cloud with Koha on AWS

Table of Contents