mailcow-dockerized-docs/docs/mysql.md

21 Zeilen
647 B
Markdown

2017-05-06 19:09:40 +02:00
MySQL is used to store the settings and / or usertables of the whole mail-stack (mailcow UI, SOGo, dovecot, postfix).
2017-05-06 00:22:26 +02:00
2017-05-06 16:52:31 +02:00
## Backup
2017-05-06 16:51:36 +02:00
2017-05-06 00:22:26 +02:00
```
cd /path/to/mailcow-dockerized
source mailcow.conf
DATE=$(date +"%Y%m%d_%H%M%S")
docker-compose exec mysql-mailcow mysqldump --default-character-set=utf8mb4 -u${DBUSER} -p${DBPASS} ${DBNAME} > backup_${DBNAME}_${DATE}.sql
```
2017-05-06 16:52:31 +02:00
## Restore
2017-05-06 00:22:26 +02:00
You should redirect the sql dump without Docker-Compose to prevent parsing errors.
```
cd /path/to/mailcow-dockerized
source mailcow.conf
docker exec -i $(docker-compose ps -q mysql-mailcow) mysql -u${DBUSER} -p${DBPASS} ${DBNAME} < backup_file.sql
```