vikunja-api/docs/content/doc/setup/backups.md

60 lines
1.5 KiB
Markdown
Raw Normal View History

2019-02-17 20:53:04 +01:00
---
date: "2019-02-12:00:00+02:00"
title: "What to backup"
draft: false
type: "doc"
menu:
sidebar:
parent: "setup"
---
# What to backup
2021-11-13 18:00:49 +01:00
There are two parts you need to back up: The database and attachment files.
2019-02-17 20:53:04 +01:00
2020-09-03 17:34:44 +02:00
{{< table_of_contents >}}
2021-11-13 18:00:49 +01:00
## Files
To back up attachments and other files, it is enough to copy them [from the attachments folder]({{< ref "config.md" >}}#basepath) to some other place.
## Database
### MySQL
2019-02-17 20:53:04 +01:00
To create a backup from mysql use the `mysqldump` command:
{{< highlight bash >}}
mysqldump -u <user> -p -h <db-host> <database> > vkunja-backup.sql
{{< /highlight >}}
You will be prompted for the password of the mysql user.
To restore it, simply pipe it back into the `mysql` command:
{{< highlight bash >}}
mysql -u <user> -p -h <db-host> <database> < vkunja-backup.sql
{{< /highlight >}}
2021-11-13 18:00:49 +01:00
### PostgreSQL
To create a backup from PostgreSQL use the `pg_dump` command:
{{< highlight bash >}}
pg_dump -U <user> -h <db-host> <database> > vikunja-backup.sql
{{< /highlight >}}
You might be prompted for the password of the database user.
To restore it, simply pipe it back into the `psql` command:
{{< highlight bash >}}
psql -U <user> -h <db-host> <database> < vikunja-backup.sql
{{< /highlight >}}
For more information, please visit the [relevant PostgreSQL documentation](https://www.postgresql.org/docs/12/backup-dump.html).
2021-11-13 18:00:49 +01:00
### SQLite
2019-02-17 20:53:04 +01:00
2021-11-13 18:00:49 +01:00
To back up sqllite databases, it is enough to copy the [database file]({{< ref "config.md" >}}#path) to somwhere else.