---
title: Export an SQL File from the Command Line
description: "A command-line export creates a portable SQL backup directly from MySQL or MariaDB. It is especially useful for larger databases, scheduled maintenance and controlled migrations where a browser export may time out. ## Prepare the export - Confirm the database…"
url: "https://support.jansma.vip/docs/vip-hosting/databases/export-an-sql-file-from-the-command-line/"
updated: "2026-09-27"
category: Databases
---

# Export an SQL File from the Command Line

A command-line export creates a portable SQL backup directly from MySQL or MariaDB. It is especially useful for larger databases, scheduled maintenance and controlled migrations where a browser export may time out.

## Prepare the export

- Confirm the database name, username and hostname in your Jansma VIP Hosting control panel.
- Choose a private directory with enough free space for the export.
- Avoid high-traffic maintenance windows when the application is writing frequently.
- Never store the database password inside a public script or command-history file.

## Create the SQL file

Connect through SSH and run `mysqldump -h DATABASE_HOST -u DATABASE_USER -p DATABASE_NAME > backup.sql`. Enter the password when prompted. For a compressed export, send the output to a compression tool only if you are comfortable restoring that format later.

## Validate and download

Check that the command completed without an error and that the resulting file has a realistic size. Inspect the first lines to confirm that it is an SQL dump, then download it through SFTP or another secure transfer method. Delete temporary server-side copies when they are no longer required.

## Keep backups secure

Database files often contain customer details, configuration values and application secrets. Store them encrypted where appropriate, restrict access and apply a documented retention period. Periodically test a restore in a safe environment; a backup is only useful when it can be recovered successfully.
