My Blog List


Friday, June 17, 2022

Koha Backup and Restoration


Koha Backup and Restoration

 Run the following command in order to take the backup of your koha database. 

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

Enter the  MySQL  database 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)

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. 

exit

"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

No comments:

Post a Comment