Old Koha Database to a New Installation

Step 1: Backup Your Old Koha Database

Backing up your data is the first and most crucial step. If your old Koha database is still running, you can create a compressed backup with this command:

sudo mysqldump -uroot -p koha_library | xz > koha_library.sql.xz

Enter your MySQL root password when prompted. This will save your backup as a compressed .xz file. Store this safely on your pen drive or an external hard drive.

Step 2: Install Koha on the New System

Next, install Koha on your new server. The official Koha Wiki provides up-to-date instructions for various operating systems. Make sure the new installation is working fine and that the web interface loads correctly.

Step 3: Restore Your Old Database

Now it’s time to move your old data into the new installation:

  1. Open MySQL: bashCopyEditsudo mysql -uroot -p
  2. Drop the existing (new) database and recreate it: sqlCopyEditdrop database koha_library; create database koha_library; quit;
  3. Copy your backup to the new server and extract it: bashCopyEditunxz koha_library.sql.xz
  4. Restore the backup: bashCopyEditsudo mysql -uroot -p koha_library < koha_library.sql

This will populate your new Koha installation with all the data from your old setup.

Step 4: Upgrade the Database Schema

Koha’s newer versions might have changes in the database structure. To make your old data compatible with the new system, upgrade the schema:

sudo service memcached restart
sudo koha-upgrade-schema library

Replace library with your Koha instance name.

Step 5: Rebuild Zebra Index

Finally, rebuild the Zebra index so all your catalog records become searchable:

sudo koha-rebuild-zebra -v -f library

This step is important to restore full functionality to your Koha catalog.

You’re Done!

That’s it! You’ve successfully migrated your Koha library database to a new server. By following these steps — backup, install, restore, upgrade, and reindex — you ensure a smooth transition with no data loss. Whether you’re upgrading Koha or just moving servers, this guide has you covered.

Credit By

Omkar Kakeru

Founder Of PlayTech

Leave a Reply

Your email address will not be published.