One of a series of test instances for migrating the Koha Wiki MediaWiki database.
For the current Koha Wiki, visit https://wiki.koha-community.org .Backing up Koha
WARNING! This page is obsolete.
This page is no longer correct and exists for historical reasons only. For installations that were created with the Debian packages, see Commands provided by the Debian packages.
mysqldump is a command line utility that can be used to dump data in the Koha database to a text file.
The examples assume a Koha database called koha and a Koha database user called kohaadmin.
Complete dump
To get all the data, use:
mysqldump -u kohaadmin -p koha > mydatadump.sql
- -u specifies the user to log in to MySQL as, in this case kohaadmin
- -p makes mysqldump prompt for the password
- koha is the name of the database
There are certain tables in the Koha database you may not want or need to dump, like sessions and zebraqueue. These can be excluded with the --ignore-table option. Note that the option must be repeated for each table, and the table name must be given as databasename.tablename:
mysqldump -u kohaadmin -p --ignore-table koha.sessions --ignore-table koha.zebraqueue koha > mydatadump.sql
Note: If you choose to not dump the sessions table, be aware that loading the resulting dump into an empty db will probably result in errors like this:
Can't call method "delete" on an undefined value at /usr/share/koha/lib/C4/Auth.pm line 717.
To avoid this, restore the dump over a fresh db or omit '--ignore-table koha.sessions'
Load data from mysqldump into a database
mysql -u kohaadmin -p koha < mydatadump.sql
A specific MARC framework
This might not be necessary since currently Koha support to export/import frameworks throw stuff-client.
Assuming you have created a MARC framework called Yourcode you can dump all the relevant data into a file with this command:
mysqldump -u kohaadmin -p koha marc_subfield_structure marc_tag_structure biblio_framework --where "frameworkcode='Yourcode'" --no-create-info > myframework.sql
Installations running off the Debian packages
For installations that were created with the Debian packages, there are scripts for doing backup and restore, specifically:
- koha-restore
- koha-dump
- koha-run-backups
See Commands provided by the Debian packages for details.
Links
- 4.5.4. mysqldump — A Database Backup Program - from the MySQL 5.1 Reference Manual