MariaDB restore database from backup - mysql

MariaDB restore database from backup - mysql

Colleagues hello to all.

In today's article, we'll talk about how to restore a database from a backup in MariaDB. Backups were created using the mysqldump utility. We will restore the database using the built-in mysql utility.

 

Related articles:

  1. MariaDB - database backup - mysqldump
  2. MariaDB mysqldump - backup with bzip2 compression

 

Article content:

  1. Restore a normal copy using the mysql utility.
  2. Restore a compressed copy using the mysql utility.

 

1. Restore a regular backup using the mysql utility.

In previous articles, we performed backups using the mysqldump utility. An example from a previous article creating a full database backup.

$. mysqldump -u root -p --all-databases --result-file=/app/mariadb_backup/dump.sql

Now, in order to restore this backup, we all just need to perform one simple action:

$. mysql -u root -p < dump.sql

mariadb_restore

After executing the specified command, our database will be completely restored at the time the backup was created.


 

2. Restore a compressed copy using the mysql utility.

In one of the examples in the last article, we performed a full database backup, but only used the compression process with the bzip2 utility to make the backup take up less disk space. An example from the last article of a full backup.

$. mysqldump -u root -p --all-databases | bzip2 > /app/mariadb_backup/dump.sql.bz2

Now, in order to restore this backup, we need to run a simple command:

$. bzcat dump.sql.bz2 | mysql -u root -p

mariadb_restore

After executing the specified command, our database will be completely restored at the time the backup was created.


 

Thank you all, I hope that my article helped you in some way.

SIMILAR ARTICLES

MariaDB - ERROR Incorrect definition of table
MariaDB - ERROR Incorrect definition of table
MARIADB
Read more
Mariabackup backup - gzip compression
Mariabackup backup - gzip compression
MARIADB
Read more
Mariabackup error - Error writing file UNKNOWN errno 32 Broken pipe
Mariabackup error - Error writing file UNKNOWN errno 32 Broken pipe
MARIADB
Read more