Restore a database

Open a running database's Backups page and select Import backup to restore a backup from your computer, the database server, or a backup storage. The import opens in a dialog. Imports are also available for supported database components inside a service stack.

Older links to the Import Backup page open the Backups page.

Protect existing data before importing

Stop application writes and take a separate backup of the target before importing. Review the selected database, backup format, generated script, and replacement options. An import can overwrite data and credentials.

When testing an SFTP, FTPS, or WebDAV destination, restore from Storage into a disposable database so the test reads the remote copy. See Verify upload and recovery.

Supported backups

DatabaseSupported restore inputs and options
PostgreSQLSQL dumps, custom archives, tar archives, and all-database dumps.
MySQL and MariaDBSQL dumps, including all-database backups; optional user and privilege restoration.
MongoDBArchives and dump directories.
SQLiteDatabase files; choose the target file under Restore into.
ClickHouseImport backup reports that restore is not supported; use a ClickHouse client.
Redis, Dragonfly, KeyDBNo Backups page and no import; use an engine-specific restore process.

Coolify detects formats before changing data and supports gzip, bz2, xz, and zip compression as well as supported archives. Ensure the backup matches the target engine and version, and that the server has enough free space.

Review restore options

Select Show import command to see the Import command, the exact generated restore script. It is read-only. Choose Backup contents for a selected-database or all-database dump as appropriate.

  • Replace objects that already exist is off by default for single-database PostgreSQL imports. Enable it to request the previous clean/replace behavior. Existing objects can otherwise make an import fail.
  • Keep owners and privileges is off by default for PostgreSQL archives. Enable it only when the destination has the required roles and you intend to restore ownership and grants.
  • Restore users and privileges (mysql system database) applies to all-database MySQL/MariaDB imports. It can replace users and passwords, including administrative credentials. Coolify's saved credentials and health checks may then need updating.
  • Restore into selects a configured SQLite file. Coolify preselects the file identified by the backup name when possible.
  • MongoDB offers Replace collections that already exist for replacing existing collections.

When Backup contents is Backup contains all databases, a MySQL or MariaDB import uses root without a password when the database does not accept the root password, for example in a service with a linuxserver.io image. A MariaDB database that sets only MYSQL_* variables uses those values. For PostgreSQL with a Supabase image, the restore connects over 127.0.0.1 instead of the socket.

PostgreSQL restores run in one transaction. Replace restores of SQL backups swap in the new database only after success. Format detection occurs before destructive changes; keep a verified backup for recovery regardless of these safeguards.

Select and import a backup

  1. Open the running target database and select Backups.
  2. Select Import backup. For a service, open the service's Backups page, select Import backup, then select the Database if the service has more than one.
  3. Under Backup source, select a source:
    • File: upload a backup from your computer, or enter the absolute File path on the server and select Check file.
    • Storage: select a team backup storage in Storage, enter the File path in the storage, and select Check file.
  4. Review file information, backup contents, restore options, and the generated import command.
  5. Start the restore and complete its confirmation.
  6. Follow Database Restore Output until the operation finishes.

If the database is not running, the dialog asks you to start it first. An SFTP storage needs a saved host key before Coolify can read a backup from it. See SFTP, FTPS, and WebDAV storage.

Coolify uses the selected source; an earlier unused upload does not replace a checked server path. A second start, restart, or import is rejected while an import runs. Interrupted or stale imports are stopped and cleaned up so they do not indefinitely block later operations.

Import through the API

For a standalone database, use:

EndpointPurpose
POST /databases/{uuid}/imports/uploadsUpload a backup.
POST /databases/{uuid}/importsStart an import from the selected source.
GET /databases/{uuid}/imports/{activity_id}Read import progress and result.

For a service database, the same suffixes are under /services/{uuid}/databases/{database_uuid}/imports.

Uploading and starting an import require write. A server-path import also requires deploy. Options include replace_existing, keep_owners, restore_mysql_users, and sqlite_database. Concurrent database operations return 409; invalid requests return 422. Use the API reference for source fields and upload formats.

Example: import a server file

After stopping application writes and backing up the target, start an import using the backup's absolute path on the database server:

curl --request POST "https://coolify.example.com/api/v1/databases/<database-uuid>/imports" \
  --header "Authorization: Bearer $COOLIFY_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{"source":"server","path":"/var/backups/database.sql.gz","dump_all":false,"replace_existing":false}'

Use a token with the required write and deploy abilities. Poll the activity endpoint with the returned activity ID and verify the result before resuming writes. Upload imports use source: "upload" and upload_id; storage imports use source: "s3", s3_storage_uuid, and path for every storage type.

Verify the result

  1. Confirm the database is running and healthy and review its logs.
  2. Connect with a database client and check schemas, tables or collections, and representative records.
  3. For SQLite, verify the application reads the intended mounted file.
  4. Update credentials if the import restored users or passwords.
  5. Reconnect application writes after validation and create a new backup.

On this page