0

The MariaDB / MySQL Database are the most popular RDBMS (Relational Database Management System) and It is used by most of the Web Applications. That’s why backup plays most important aspect to secure your database. The mysqldump is the command that is useful to take backup in various output format. It is useful when all the backup is taken in single file that is useful for database restoration purpose. Also the mysqldump is also useful to take backup of data in various time interval using crontab to schedule backup of database. This tutorial explains how to take complete the database backup using mysqldb command.

Backup all the database

This command is useful when you take the compete backup of your database.

Syntax of command

# mysqldump –all-database -u databaseusername -p > path of destination where backup can be stored

Example command
# mysqldump --all-database -u databaseusername -p > /home/techbrown/full-backup.sql

Backup a single database

This command is very useful when you take backup of single selected database.

Syntax of command

# mysqldump -u databaseusername -p databasename > path of destination where backup can be stored

Example command
# mysqldump -u root -p techbrowndatabase > /home/techbrown/techbrowndatabase.sql

Backup a selected tables from a database

This command is very useful when you select the tables from a database and output in text format.

Syntax of command

# mysql databasename -e “SELECT tablename1, tablename2, tablename3 \ FROM databasename” > path of destination where backup can be stored

Example command
# mysql techbrowndatabase -e "SELECT user1, user2, user3 \ FROM techbrowndatabase" > /home/techbrown/techbrowndatabase.txt

That’s all for now.

 

How to Setup UFW Firewall on Ubuntu / Debian

Previous article

How to Harden SSH to Secure a Linux VPS Server

Next article

You may also like

Comments

Leave a reply

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

More in Linux