Repository navigation
Database Backups
BBS provides dedicated plugins for backing up MySQL, PostgreSQL, and MongoDB databases. These plugins automatically dump databases before each backup operation, ensuring consistent, point-in-time database backups.
Database backup plugins work by:
- Running a database dump (mysqldump, pg_dump, or mongodump) before Borg creates the backup archive
- Saving the dump files to a specified directory on the client machine
- Including those dump files in the regular Borg backup
- Allowing one-click restoration through the BBS web interface
- Navigate to the client detail page
- Click the Plugins tab
- Toggle MySQL Backup to enabled

- On the Plugins tab, click Add Configuration under MySQL Backup
- Fill in the configuration details:
- Configuration Name: A descriptive name (e.g., "Production MySQL", "WordPress DB")
- MySQL Host: Hostname or IP address (default: localhost)
- Port: MySQL port (default: 3306)
- Username: MySQL user with appropriate privileges
- Password: MySQL password
-
Databases:
*for all databases, or a comma-separated list -
Dump Directory: Local path where dumps will be stored (default:
/home/bbs/mysql)
- Save the configuration
| Field | Description | Example |
|---|---|---|
| MySQL Host | MySQL server hostname or IP |
localhost, db.example.com
|
| Port | MySQL server port | 3306 |
| Username | MySQL user with SELECT, LOCK TABLES, SHOW VIEW privileges | bbs_backup |
| Password | MySQL password (encrypted in BBS) | •••••••• |
| Databases |
* for all, or a comma-separated list |
wordpress,joomla or *
|
| Dump Directory | Absolute path on the client for dump files. See Dump Directory Rules | /home/bbs/mysql |
| Compress dumps (gzip) | Write .sql.gz instead of .sql
|
Enabled (default) |
| Delete dumps after backup completes | Remove the dump files once the backup succeeds | Enabled (default) |
| Exclude Databases | Databases to skip when using *
|
information_schema,performance_schema,sys |
| Extra mysqldump Options | Additional mysqldump flags. See Extra Options |
--single-transaction --quick --routines --triggers --events (default) |
- Go to the client detail page → Backup Plans tab
- Create a new backup plan or edit an existing one
- In the Plugins section, select your MySQL configuration from the dropdown
- The dump directory is added to the backup automatically
- Save the backup plan
When a backup job runs with a MySQL plugin attached:
- Agent receives the backup job with plugin instructions
- Before running
borg create, the agent executesmysqldumpfor each database, roughly:The password is in the temporary option file, not on the command line. See Passwords.mysqldump --defaults-extra-file=/tmp/bbs-mysql-XXXX.cnf --host=HOST --port=PORT --user=USERNAME \ EXTRA_OPTIONS -- DATABASE | gzip > /dump/dir/DATABASE.sql.gz
- One
.sql.gzfile (or.sqlwith compression off) is created per database - Borg then backs up the dump directory along with all other specified directories
- The SQL dump files are included in the Borg archive
- After a successful backup, the dump files are deleted if Delete dumps after backup completes is on
- Navigate to client detail → Restore tab
- Select a backup archive that contains database dumps (indicated by a database icon)
- Click Restore Database
- Fill in the restore form:
- Select Databases: Choose which databases to restore
- Target MySQL Server: Hostname/IP of the MySQL server (can be different from original)
- Port: Target MySQL port
- Username: MySQL user with CREATE DATABASE and INSERT privileges
- Password: Target MySQL password
-
Rename Databases (optional): Rename databases during restore (e.g.,
prod_db→restored_db)
- Click Restore
The restore process:
- Extracts the requested SQL dump files from the Borg archive
-
Safety backup (Replace mode): Before overwriting, the current database is dumped to
dump_dir/dbname_pre_restore.sql.gzso you can recover if the restore goes wrong - Connects to the target MySQL server
- Creates databases (or drops/recreates if they exist)
- Imports the SQL dump with
mysql, passing the password in a private option file as for backups
- Navigate to the client detail page
- Click the Plugins tab
- Toggle PostgreSQL Backup to enabled
- On the Plugins tab, click Add Configuration under PostgreSQL Backup
- Fill in the configuration details:
- Configuration Name: A descriptive name (e.g., "Production PostgreSQL")
- PostgreSQL Host: Hostname or IP address (default: localhost)
- Port: PostgreSQL port (default: 5432)
- Username: PostgreSQL user with appropriate privileges
- Password: PostgreSQL password
-
Databases:
*for all databases, or a comma-separated list -
Dump Directory: Local path where dumps will be stored (default:
/home/bbs/pgdump)
- Save the configuration
| Field | Description | Example |
|---|---|---|
| PostgreSQL Host | PostgreSQL server hostname or IP |
localhost, pg.example.com
|
| Port | PostgreSQL server port | 5432 |
| Username | PostgreSQL user | bbs_backup |
| Password | PostgreSQL password (encrypted in BBS) | •••••••• |
| Databases |
* for all, or a comma-separated list |
app_db,analytics or *
|
| Dump Directory | Absolute path on the client for dump files. See Dump Directory Rules | /home/bbs/pgdump |
| Compress dumps (gzip) | Write .sql.gz instead of .sql
|
Enabled (default) |
| Delete dumps after backup completes | Remove the dump files once the backup succeeds | Enabled (default) |
| Exclude Databases | Databases to skip when using *
|
template0,template1,postgres |
| Extra pg_dump Options | Additional pg_dump flags. See Extra Options |
--no-owner --no-privileges (default) |
Follow the same process as MySQL:
- Create or edit a backup plan
- Select your PostgreSQL configuration in the Plugins section
- The dump directory is added to the backup automatically
- Save the plan
When a backup job runs with a PostgreSQL plugin attached:
- Before running
borg create, the agent executespg_dumpfor each database, roughly:The password is passed in thePGPASSWORD=PASSWORD pg_dump -h HOST -p PORT -U USERNAME \ EXTRA_OPTIONS -- DATABASE | gzip > /dump/dir/DATABASE.sql.gz
PGPASSWORDenvironment variable, not on the command line. The agent uses thepg_dumpthat matches the server's major version when one is installed. - One plain SQL
.sql.gzfile (or.sqlwith compression off) is created per database - Borg backs up the dump directory
- The dump files are included in the archive
- After a successful backup, the dump files are deleted if Delete dumps after backup completes is on
- Navigate to client detail → Restore tab
- Select an archive with PostgreSQL dumps (database icon indicator)
- Click Restore Database
- Fill in the restore form:
- Select Databases: Choose which databases to restore
- Target PostgreSQL Server: Hostname/IP
- Port: Target PostgreSQL port
- Username: PostgreSQL user with CREATEDB privileges
- Password: Target password
- Rename Databases (optional): Rename during restore
- Click Restore
The restore process:
- Extracts the requested dump files from the archive
-
Safety backup (Replace mode): Before overwriting, the current database is dumped to
dump_dir/dbname_pre_restore.sql.gzso you can recover if the restore goes wrong - Connects to the target PostgreSQL server
- Creates databases if needed
- Imports the SQL dump with
psql:gunzip -c /path/to/DATABASE.sql.gz | PGPASSWORD=PASSWORD psql -h HOST -p PORT -U USERNAME -d DATABASE
- Navigate to the client detail page
- Click the Plugins tab
- Toggle MongoDB Backup to enabled
- On the Plugins tab, click Add Configuration under MongoDB Backup
- Fill in the configuration details:
- Configuration Name: A descriptive name (e.g., "Production MongoDB")
- MongoDB Host: Hostname or IP (default: 127.0.0.1)
- Port: MongoDB port (default: 27017)
- Username: MongoDB user (leave empty if auth is not enabled)
- Password: MongoDB password (leave empty if auth is not enabled)
-
Authentication Database: The auth database, usually
admin -
Databases:
*for all databases, or comma-separated list -
Dump Directory: Local path for dumps (default:
/home/bbs/mongodump) - Compress: Enable gzip compression (recommended)
-
Exclude Databases: Databases to skip when using
*(default: admin, config, local)
- Click Save Configuration
| Field | Description | Example |
|---|---|---|
| MongoDB Host | Server hostname or IP |
127.0.0.1, mongo.example.com
|
| Port | MongoDB server port | 27017 |
| Username | MongoDB user (optional) | bbs_backup |
| Password | MongoDB password (encrypted in BBS) | •••••••• |
| Authentication Database | Auth DB for credentials | admin |
| Databases | Comma-separated list or * for all |
myapp,analytics or *
|
| Dump Directory | Absolute path on the client for dump files. See Dump Directory Rules | /home/bbs/mongodump |
| Compress dumps (gzip) | Use gzip compression | Enabled (recommended) |
| Delete dumps after backup completes | Remove each database's dump folder once the backup succeeds | Enabled (default) |
| Exclude Databases | DBs to skip with *
|
admin,config,local |
| Extra mongodump Options | Additional CLI flags. See Extra Options |
--oplog (for replica sets) |
Follow the same process as MySQL/PostgreSQL:
- Create or edit a backup plan
- Select your MongoDB configuration in the Plugins section
- The dump directory is automatically included in backup directories
- Save the plan
When a backup job runs with a MongoDB plugin attached:
- Before running
borg create, the agent lists databases viamongosh - For each database, the agent runs
mongodump, roughly:The password is in the temporary config file, not on the command line. See Passwords.mongodump --host=HOST --port=PORT --username=USER --authenticationDatabase=admin \ --config=/tmp/bbs-mongo-XXXX.yaml --db=DATABASE --out=/dump/dir --gzip EXTRA_OPTIONS
- One directory per database is created (e.g.,
/dump/dir/myapp/) - Borg backs up the dump directory
- After backup completes, dump files are cleaned up (if enabled)
- Navigate to client detail > Restore tab
- Select a backup archive that contains MongoDB dumps (database icon indicator)
- Click Restore Database
- Select the MongoDB connection config from the dropdown
- Choose which databases to restore
- Select restore mode:
- Replace: Drops and restores the database (a safety backup is created automatically)
- Rename: Restores to a new database name
- Click Restore
The restore process:
- Extracts the requested database directories from the Borg archive
-
Safety backup (Replace mode): Before dropping and restoring, the current database is dumped to
dump_dir/_pre_restore/dbname/so you can recover if the restore goes wrong - Restores using
mongorestore, with the password passed the same way as for backups:mongorestore --host=HOST --port=PORT --username=USER --authenticationDatabase=admin \ --config=/tmp/bbs-mongo-XXXX.yaml --db=DATABASE --drop --gzip /dump/dir/DATABASE
For backups (run in mongosh):
use admin
db.createUser({
user: "bbs_backup",
pwd: "strong_password",
roles: [
{ role: "backup", db: "admin" },
{ role: "readAnyDatabase", db: "admin" }
]
})For restores (additional roles):
db.grantRolesToUser("bbs_backup", [
{ role: "restore", db: "admin" },
{ role: "readWriteAnyDatabase", db: "admin" }
])Authentication is optional. If your MongoDB instance does not require auth, leave the username and password fields empty.
The following must be installed on the client machine:
-
mongodumpandmongorestore(part of MongoDB Database Tools); version 100.3 or newer keeps the password off the command line -
mongoshormongoshell (for database discovery and connectivity testing)
The dump tools run as root on the client, so BBS limits what a plugin configuration can make them do (BBS 2.98.4 and later). The server checks the Extra Options and Dump Directory rules when a configuration is saved, on the web and over the API, and the agent checks all of them again before each dump. A configuration saved before the rules existed that breaks one fails at backup time with the same message.
Options that make the dump tool write or load a file of its choosing are refused in the Extra Options field:
| Tool | Refused long options | Refused short options |
|---|---|---|
| mysqldump |
--result-file, --tab, --log-error, --debug, --plugin-dir, --default-auth, --defaults-file, --defaults-extra-file, --defaults-group-suffix, --character-sets-dir, --load-data-local-dir
|
-r, -T, -#
|
| pg_dump | --file |
-f |
| mongodump |
--out, --archive, --config
|
-o |
mysqldump accepts abbreviations of long options, so abbreviations such as --result are refused too. A short option group that contains one of the refused letters is refused as a whole; write other options in their long form. Other options, such as --single-transaction, --no-owner or --oplog, are allowed.
- The dump directory must be an absolute path, such as
/home/bbs/mysql. - It can't be a system directory. Anything under
/etc,/usr,/bin,/sbin,/lib,/boot,/dev,/proc,/sysor/snapis refused, and so are/,/root,/var,/home,/tmp,/optand/srvthemselves. Use a subfolder such as/home/bbs/mysqlor/var/backups/mysql.
With Delete dumps after backup completes on, the agent deletes every .sql and .sql.gz file in the MySQL or PostgreSQL dump directory after each successful backup, not only the files it wrote. Give each configuration its own directory that holds nothing else. For MongoDB, the agent removes the folder of each database it dumped.
The agent refuses to dump a database whose name starts with -, contains / or \, or is . or ... This applies to names typed in the Databases field and to names found when using *.
Database passwords are stored encrypted in BBS and sent to the agent with each job. The agent keeps them out of the process list, where other local users could read them:
-
MySQL: the password goes in a private temporary option file passed with
--defaults-extra-file, never on the command line. The file is deleted when the dump or restore ends. -
PostgreSQL: the password goes in the
PGPASSWORDenvironment variable. -
MongoDB (BBS 2.98.6 and later): mongodump and mongorestore read the password from a private temporary config file passed with
--config. This needs MongoDB Database Tools 100.3 or newer.mongoshgets it from its environment when listing databases. Older Database Tools and the legacymongoshell can't read it that way, so with those the password is still passed on the command line. Upgrade them to keep it out of the process list.
Before running your first backup, test your database plugin configuration:
- On the Plugins tab, find your saved configuration
- Click the Test button next to the configuration
- BBS queues a
plugin_testjob - Navigate to Queue to monitor the test
- Review the test results:
- Success: Plugin is configured correctly, dumps were created
- Failure: Check the error log for connection issues, permission problems, or incorrect credentials
Common test failure reasons:
- Connection refused: Database server not reachable, firewall blocking connection
- Access denied: Incorrect username/password, or user lacks necessary privileges
- Directory not writable: Dump directory doesn't exist or agent user lacks write permissions
- Database not found: Specified database doesn't exist on the server
- Use a dedicated backup user with minimal privileges:
CREATE USER 'backup'@'localhost' IDENTIFIED BY 'password'; GRANT SELECT, LOCK TABLES, SHOW VIEW, EVENT, TRIGGER ON *.* TO 'backup'@'localhost'; FLUSH PRIVILEGES;
- Use
--single-transactionfor InnoDB tables (automatically included) - Ensure the dump directory has sufficient space (estimate database size)
- Consider backing up all databases (
*) to capture mysql.user and system tables
- Use a dedicated backup role:
CREATE ROLE backup WITH LOGIN PASSWORD 'password'; GRANT CONNECT ON DATABASE your_db TO backup; GRANT SELECT ON ALL TABLES IN SCHEMA public TO backup;
- Dumps are plain SQL, gzip-compressed by default, and BBS restores them with
psql. Don't add-Fcor another non-plain format to Extra Options, or the restore can't import the file - Ensure
pg_dumpandpg_restoreare installed on the client machine
- Use a dedicated backup user with minimal roles (
backup+readAnyDatabase) - Use
127.0.0.1instead oflocalhostto avoid IPv6 connection issues - Enable gzip compression to reduce dump size
- For replica sets, consider adding
--oplogin Extra Options for point-in-time consistency - The default exclusions (admin, config, local) are correct for most setups
- Ensure MongoDB Database Tools are installed (
mongodump,mongorestore,mongosh)
- Named Configurations: Create reusable named configs for each database server. Share configs across multiple backup plans.
-
Dump Directory: Use a dedicated directory outside web roots that holds nothing else (e.g.,
/var/backups/mysql, not/var/www/dumps). See Dump Directory Rules - Encryption: BBS encrypts all database passwords using the APP_KEY
- Test Regularly: Run test jobs after changing credentials or database structure
- Monitor Space: Database dumps can be large. Monitor disk space on both client and backup storage.
- Retention: Borg's deduplication handles dump file changes efficiently, but old dumps are only removed when archives are pruned
| Problem | Solution |
|---|---|
| Access denied for user | Verify username/password, check MySQL user permissions |
| Can't connect to MySQL server | Check host/port, ensure MySQL is running, verify firewall rules |
| Unknown database | Verify database names are correct, check for typos |
| Dump directory not found | Create the directory on the client, ensure agent user has write access |
| Lock wait timeout | Reduce concurrent connections, consider --skip-lock-tables for non-InnoDB |
| Problem | Solution |
|---|---|
| password authentication failed | Verify username/password, check pg_hba.conf settings |
| could not connect to server | Check host/port, ensure PostgreSQL is running, verify firewall |
| database does not exist | Verify database names, check spelling |
| permission denied | Grant SELECT on all tables in schema to backup user |
| pg_dump: command not found | Install postgresql-client package on the agent machine |
| Problem | Solution |
|---|---|
| mongodump: command not found | Install MongoDB Database Tools on the client machine |
| mongosh: command not found | Install mongosh (or legacy mongo shell) for database discovery |
| Authentication failed | Verify username/password and authenticationDatabase (usually admin) |
| Connection refused | Check host/port, ensure MongoDB is running, verify firewall rules |
| No databases found | Check that the user has listDatabases privilege |
| IPv6 connection issues | Use 127.0.0.1 instead of localhost
|
| Problem | Solution |
|---|---|
| "Extra options: ... is not allowed" | Remove the option. See Extra Options |
| "Dump directory must be an absolute path" | Use a full path starting with /
|
| "Dump directory cannot be a system directory" | Use a dedicated subfolder. See Dump Directory Rules |
| "Refusing to dump database with unsafe name" | Rename the database, or exclude it with Exclude Databases |
| Problem | Solution |
|---|---|
| Restore fails with "database exists" | Drop the database first, or enable force/overwrite option |
| Access denied during restore | Target user needs CREATE DATABASE and INSERT privileges |
| Syntax errors during restore | Version mismatch between dump and target server |
| Restore incomplete | Check target disk space, review restore job logs |
- Plugins — Overview of all BBS plugin types
- Queue-and-Jobs — Monitoring backup and restore jobs
- Troubleshooting — General BBS troubleshooting guide
📖 User Manual
Getting Started
Using BBS
- Dashboard
- Managing Clients
- Client Profiles
- Linux Agent Setup
- macOS Agent Setup
- Windows Agent Setup
- Docker Agent Setup
- Repositories
- Storage Setup
- Backup Plans
- Restoring Files
- Database Backups
- Plugins
- Remote Storage
- S3 Offsite Sync
Monitoring
Administration
- Settings
- User Management
- Single Sign-On
- Two-Factor Authentication
- Updating BBS
- Server Backup and Restore
Reference