Prerequisites
Before restoring a database, make sure you have:
- Access to HestiaCP control panel or SSH
- A database backup file (.sql or .sql.gz)
⚠️ Restoring a database will overwrite existing data. Backup current data first if needed!
Method 1: Restore via phpMyAdmin
Step 1: Access phpMyAdmin
https://yourdomain.com/phpmyadmin
Step 2: Select Database
Select the database from the left sidebar.
Step 3: Import Tab
Click on the Import tab.
Step 4: Choose File
Click Choose File and select your .sql backup.
Step 5: Execute
Click Go at the bottom to restore.
Method 2: Restore via SSH (MySQL)
ssh hxroot@YOUR_SERVER_IP -p 22
Create database if it doesn''t exist:
mysqladmin -u root -p create database_name
Restore from .sql file:
mysql -u username -p database_name < backup.sql
Restore from compressed .gz:
gunzip < backup.sql.gz | mysql -u username -p database_name
Method 3: Restore to Different Database
mysql -u root -p new_database_name < backup.sql
Method 4: Restore Specific Tables
Extract specific table from backup:
sed -n '/CREATE TABLE `tablename`/,/UNLOCK TABLES/p' backup.sql > table_restore.sql
mysql -u username -p database_name < table_restore.sql
Restore from HestiaCP Full Backup
If you have a HestiaCP full system backup:
/usr/local/hestia/bin/v-restore-user admin backup_file.tar
✅ Database has been restored successfully!