Overview
Memos supports three database backends (SQLite, MySQL, PostgreSQL), each requiring different backup strategies. This guide covers best practices for backing up your data and restoring it when needed.Database Location
By default, Memos stores data in:SQLite Backup
SQLite is the default database and the simplest to backup.Method 1: File Copy (Offline)
The safest method is to stop Memos and copy the database file:Method 2: SQLite Online Backup (Recommended)
Use SQLite’s.backup command while Memos is running:
- Works while Memos is running
- Creates a consistent snapshot
- Handles WAL mode correctly
Method 3: Automated Backup Script
Create a backup script for regular backups:SQLite Restore
MySQL Backup
Method 1: mysqldump (Recommended)
Usemysqldump for logical backups:
Method 2: Automated MySQL Backup
~/.my.cnf:
MySQL Restore
PostgreSQL Backup
Method 1: pg_dump (Recommended)
Method 2: Automated PostgreSQL Backup
~/.pgpass:
PostgreSQL Restore
Backup Verification
Always verify your backups are restorable:SQLite Verification
MySQL Verification
PostgreSQL Verification
Migration Between Databases
Migrating between different database engines requires exporting and re-importing data:Export Data (Any Database)
Use the Memos API to export all memos:Import to New Database
- Set up new database (SQLite/MySQL/PostgreSQL)
- Update
MEMOS_DRIVERandMEMOS_DSN - Start Memos (it will create schema)
- Use API or manual SQL to import data
- Exporting via API
- Using database-specific tools (e.g., pgloader for PostgreSQL)
- Manual data transfer with SQL scripts
Cloud Storage Integration
Backup to cloud storage for off-site protection:AWS S3
Backblaze B2
rclone (Multiple Providers)
Disaster Recovery Checklist
- Regular automated backups (daily minimum)
- Off-site backup storage (cloud or remote server)
- Backup verification (monthly test restore)
- Documented restore procedure
- Backup retention policy (e.g., 30 days)
- Monitor backup job success/failure
- Backup both database AND assets directory
Backup Best Practices
- 3-2-1 Rule: 3 copies, 2 different media, 1 off-site
- Test Restores: Regularly verify backups are restorable
- Automate: Use cron jobs for scheduled backups
- Monitor: Set up alerts for backup failures
- Encrypt: Encrypt backups containing sensitive data
- Version: Keep multiple backup versions (rolling window)
- Document: Keep restore procedures up to date
Example: Complete Backup Strategy
Next Steps
Architecture
Understand Memos system architecture
Security
Security best practices and hardening
Performance Tuning
Optimize for production workloads
Deployment
Deployment guides for various platforms