Knowledgebase

How to backup sql database with terminal Print

  • 0

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


Was this answer helpful?
« Back