User

Database Backups

How to export, back up, and restore MariaDB databases in Opterius.

Last updated 1775606400

There are three ways to back up a database. Choose based on database size and how often you need to do it.

Option 1: phpMyAdmin Export

Good for: one-off exports, small-to-medium databases, no SSH required.

  1. Open phpMyAdmin at https://YOUR_SERVER:8081.
  2. Select your database from the left sidebar.
  3. Click the Export tab.
  4. Choose Quick format (SQL) and click Go.
  5. Your browser downloads a .sql file.

[!TIP] For large databases, use Custom export and enable the compress output option (gzip). This significantly reduces download size and export time.

Option 2: Panel Backups

Go to Hosting Mode → Backups → Create Backup. The panel runs mysqldump server-side and includes the resulting SQL in the backup archive alongside your files. This is the recommended method for scheduled, automated backups — configure a backup schedule in the Backups section.

Downloaded backup archives include a databases/ directory containing one .sql file per database.

Option 3: SSH + mysqldump

Good for: scripting, large databases, maximum control.

Connect via SSH, then run:

mysqldump -u username_dbuser -p username_dbname > /home/username/backup_$(date +%Y%m%d).sql

You will be prompted for the database user's password. To avoid the prompt in scripts, create a ~/.my.cnf:

[client]
user     = username_dbuser
password = your-password

Then run without the password flag:

mysqldump username_dbname > /home/username/backup_$(date +%Y%m%d).sql

Compress it:

mysqldump username_dbname | gzip > /home/username/backup_$(date +%Y%m%d).sql.gz

[!NOTE] ~/.my.cnf contains your database password in plain text. Set permissions to 600 immediately: chmod 600 ~/.my.cnf

Importing / Restoring

Via phpMyAdmin: Database → Import tab → choose your .sql file → Go.

Via SSH:

mysql -u username_dbuser -p username_dbname < backup.sql

For a gzip-compressed dump:

gunzip < backup.sql.gz | mysql -u username_dbuser -p username_dbname

[!IMPORTANT] Importing into an existing database merges data. If you're doing a full restore, drop all tables first or import into a freshly created empty database to avoid conflicts with existing rows.