Koha Backup and Restoration

Backup and restoration

Run the following command from the terminal in order to take the backup of your Koha database. 

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

Enter the  MySQL root password.

(Check the name of your database,  in the above-mentioned command, root is a username for MySQL database (usually it is root unless you changed it) koha_library is a database name, and koha_library.sql.xz is the name of the database backup file)

A zipped SQL file (koha_library.sql.xz) of your backup will be stored in the home folder. Save the backup file in Pendrive, Google Drive, or anywhere else.

Now Restore the database backup in the newly installed Koha machine

Apply following commands

sudo su  (Hit Enter and enter the password)

sudo apt-get update

Open the MySQL database

sudo mysql -uroot -p 

Enter the MySQL database password

Drop (remove) the existing database from koha.

drop database koha_library;

Now create the new database named "koha_library"

create database koha_library;

quit;

Place your database backup file in the home folder. Extract the backup file if it is in compressed format. The extension of the file should be .sql

Execute the below command to restore the old backup to the new Koha installation.

sudo mysql -uroot -p koha_library < koha_library.sql    

Enter the MySQL database password. 

"koha_library" is the name of the database in the newly installed koha (Change it if you have created a database with the other name)  

and "koha_library.sql" is the name of the database file which will be restored.

Upgrade Database Schema

Apply the following commands  to upgrade the database schema

sudo service memcached restart

sudo koha-upgrade-schema library

Rebuild the Zebra Index.

Apply the following command

sudo koha-rebuild-zebra -v -f library


See Also:-

Koha Backup by GUI mode

Koha Auto backup in Dropbox

Koha Backup in Google Drive

Post a Comment

0 Comments