MySQL Database Backup From The Command Line

On the off chance that you have utilized MySQL for some time, you have likely utilized mysqldump to backup your database. In this article, I am going to show you how to create a simple full and partial backup using mysqldump.

The mysqldump client is a utility that performs logical backups, producing a set of SQL statements that can be run to reproduce the original schema objects, table data, or both. It dumps one or more MySQL database for backup or transfer to another SQL server. The mysqldump command can also generate output in CSV, other delimited text, or XML format.

Creating MySQL Backup

The mysqldump command is used create a text file or dump the MySQL database. Dump is a simple text file with all SQL commands needed to recreate the database from scratch. Follow the below steps to make a database dump file.

Single Database Backup

If you want to take a single database backup, you can type the below command to create the dump and send the output into a file.

# mysqldump database_name > database_name.sql

Multiple Database Backup

You can also take multiple database backup, type the below command for multiple database backup.

# mysqldump --databases database_one database_two > two_databases.sql

All Database Backup

For all database base backup type the below command.

# mysqldump --all-databases > all_databases.sql

Restore MySQL Backup

Since the dump files are just SQL commands, you can restore the database backup using my below article.


Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment