How to backup sql database with terminal

To dump a single database, run the command below to dump the database and write the output text to a .sql file:

mysqldump db_name > db_name.sql

You can also export multiple databases to the same .sql dump. In this command “db_name1” and “db_name2” are the names of individual databases to be exported together.

mysqldump --databases db_name1 db_name2 > databases.sql

Backing Up All Databases

It is also simple to back up all of the databases on a server:

mysqldump --all-databases > all_databases.sql

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How To Set Up a Firewall Using FirewallD on CentOS 7

sudo yum install firewalld sudo systemctl enable firewalld sudo reboot sudo...

How to Enable Firewalld on centos 7

sudo systemctl status firewalld sudo systemctl enable firewalldsudo systemctl unmask --now...

How to Install VIM editor on CentOS

vim sudo yum install vim-enhanced -y  

How to Test Internet Speed on Linux

Step 1: Python can be installed on your machine by executing the command that is provided in the...