Home  »  ArticlesGuidesHow ToLibrariesSoftwareTechnology   »   How to Move Your old Koha Database to new Upgraded Koha Installation

How to Move Your old Koha Database to new Upgraded Koha Installation

This guide will walk you through the steps you need to take to move your old koha database to a newly installed Koha setup. The instructions shown here will be run on an Ubuntu server as a reference.

1. Backup Your Koha Database

Start by taking backup of your existing Koha database by running the following command in your Ubuntu server terminal. These commands will result in storing the backup in your current directory. We also assume your koha database is named koha_library. You should replace koha_library with whatever your database is named.

$ sudo su
# mysqldump --single-transaction -u root -p koha_library > koha_library.sql

2. Install Koha

Do this if you have not yet installed Koha by following these instructions on the Koha wiki.

If you have already installed Koha then you should upgrade your system using the following commands one by one:

# apt-get update

# apt-get upgrade

# apt-get install koha-common 

3. Restore old Koha Database into the new Koha Installation

Start by remove the existing database in the new Koha installation using these commands:

# sudo mysql -u root -p

[Enter the Linux / MySQL Root password depending on your setup]

mysql> drop database koha_library;
mysql> create database koha_library;
mysql> quit;

Go to the directory where you saved your backup of the old Koha sql file. If it is from a portable media such as a pen drive or external hard drive then yo should copy it to your home directory.

Once you are ready run the following command:

# mysql -u root -p koha_library < koha_library.sql

Where koha_library is the name of the database and koha_library.sql is the backup from the old setup.

4. Upgrade Koha Database Schema

The Koha database schema of old Koha installation should upgrade to match with the new version (ideally above version 19). Run the following commands in a terminal:

$ sudo service memcached restart

$ sudo koha-upgrade-schema library

5. Rebuild the Zebra Index

Run the following command in your server terminal:

$ sudo koha-rebuild-zebra -v -f library

That’s it, you have now upgraded your old Koha database to a newer Koha installation.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.