Databases

Import and export

Load a .sql or .sql.gz dump into a MariaDB database from its page, and download a fresh export of a database as .sql.gz.

Last updated

A database's page has Import and Export buttons. Import loads a dump made by phpMyAdmin, mysqldump or a backup. Export downloads a fresh dump of the database.

Importing needs agent 0.43.0 or newer on the server.

Import a dump

Open the database

Go to Databases and open the database. It must be active. Click Import.

Choose the file

Under File, choose a .sql or .sql.gz file. Other files are refused: unzip a .zip and upload the .sql inside it, or compress the file with gzip instead.

Choose how to import

OptionWhat it does
Empty the database firstEvery table in the database is removed, then the file is imported. Off by default: the file then runs on top of what is there.
Back up firstOn by default. Takes a backup of the database as it is now, to restore from the Backups page if the import goes wrong. If the backup fails, nothing is imported. Shown with the backups.manage permission.

Import

Click Import, or Empty and import when the database is emptied first. The page shows each step: the backup, the upload with its progress, then Importing on the server.

The file goes to the panel in pieces of up to 8 MB, and the server's agent then fetches it, checked against its SHA-256. Files up to VAULTPANEL_FILE_UPLOAD_MAX_MB (2048 MB by default) can be imported.

How the import runs

A dump file may come from anyone, so the server runs it with as few rights as it can:

  • The mysql client runs as the nobody user, in its sandbox mode, so the file cannot run shell or file commands.
  • It signs in as an account that can reach only this database. A dump cannot change other databases or accounts.

The sandbox mode needs a recent MariaDB client (10.5.25, 10.6.18, 10.11.8, 11.0.6 or newer). On an older one, imports are refused: update MariaDB on the server.

Export a database

Click Export. The server writes a fresh backup of the database, and the download of it (.sql.gz) starts when it is ready. The export is also kept as a backup, listed on the Backups page.

Export needs the backups.manage permission. See Backing up and restoring.

Troubleshooting

When an import stops, what came before that point is already in the database. The error says why it stopped:

  • The file uses another database (CREATE DATABASE or USE): remove those lines, or export the database without them.
  • The file sets a DEFINER (views, triggers or procedures): export without definers, or remove the DEFINER=... parts.
  • Any other error: fix the file, then import again with Empty the database first ticked.

Permissions

PermissionAllows
databases.manageImporting into a database.
backups.manageExporting a database, and backing it up before an import.

Hosting customers can import into their own databases.

See Import a dump in the API reference.