How to Back Up and Restore MariaDB Databases From the Command line


 

mysqldump is the utility that we will use to reinforcement our MariaDB data set. It’s planned explicitly for reinforcement reason. The cool thing about mysqldump is that you don’t have to stop MariaDB administration to make a reinforcement. It tends to be utilized to reinforcement a solitary information base, various data sets and all data sets. As a matter of course it will make a dump document which contains every one of the assertions expected to re-make the data set.

 

In this post, We will take backup and restore MariaDB’s database on ubuntu 18.04 LTS

 

Taking Single Database

 

To get single MariaDB database backup, You need to execute the following command.

mysqldump -u root -p database_name > database_name.sql

 

While using this command you need to replace the database name. 

 

Taking Multiple Databases backups
 

To get multiple databases backups, you need to use the –databases switch with mysqldump command.

 

mysqldump -u root -p --databases DB_name1 DB_name2  > multi_database.sql

 

Taking All Databases

 

To get all of your MariaDB databases backup, You need to use –all-databases switch with mysqldump.

mysqldump -u root -p --all-databases > all-databases.sql


Restoring MariaDB Database

 

There is single command to restore the MariaDB database even its single, multple and all databases, Use the given command for the same.

mysql -u root -p database_name < database_name.sql


Conclusion

We have successfully took mariaDB’ database backup and we have restored it in our Ubuntu 18.04 server.


 

How to Back Up and Restore MariaDB Databases From the Command line

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top