A database backup is useful only if it is readable, complete and restorable when needed. The existence of an SQL file alone does not prove the backup process works.
This guide provides a practical approach for MySQL and MariaDB: consistent exports, secure storage, verification and test restores, step by step.
The backup includes a test restore
A logical backup records the database structure and data as SQL. Application uploads, environment variables and secret keys still need separate backups.
Open image full size Konzisztens export MySQL vagy MariaDB alatt
Use mysqldump for MySQL or the supported mariadb-dump client for MariaDB; check options against your version's documentation. The MySQL example below uses a transaction during the backup to reduce inconsistent export risk for InnoDB tables. Do not put the password on the command line; use the client's secure authentication method.
mysqldump --single-transaction --routines --triggers --events \
pelda_adatbazis > pelda_adatbazis-YYYY-MM-DD.sqlDo not stop after creating a backup
- Check the command's exit code and confirm the file is not empty.
- Create a checksum, then copy the backup to access-controlled storage independent of the server.
- Encrypt backups containing confidential or personal data.
- Keep multiple recovery points; immediate overwriting can propagate corrupted or encrypted data too.
- Record the application's version, backup timestamp and database version associated with the file.
Test restore into a separate database
Do not begin testing on the production database. Create an isolated test environment and import the backup there. The export shown here omits --databases, so it does not automatically include a USE statement. For SQL files from other sources, also inspect CREATE DATABASE, USE and DROP statements. Use a separate test account that cannot access the production database.
- Monitor import errors and the exit code.
- Check tables, expected record counts and selected business-critical data.
- Connect an isolated application instance and test sign-in, search, forms or the ordering process.
- Document total recovery time and every required manual step.
mysql teszt_adatbazis < pelda_adatbazis-YYYY-MM-DD.sqlQuestions for a practical backup policy
- How often are backups taken, and how much data loss is acceptable?
- How long are daily, weekly and monthly copies retained?
- Who can access the backups, and where is the encryption key?
- How quickly must the service recover?
- When was the last successful, documented test restore?



