Quick command to take MySQL database backup in Linux

Hey friends,

As a database administrator, you must be required to take periodic backup of your database from time to time. Sometime it might be routine backup or sometime you may be required to take a backup if you are going to do some major structural changes to the database.



Here is the backup command you should keep handy in order to take MySQL database backup in Linux.


sudo mysqldump -u [username] -p [database_name] > [backup_filename.sql]


The above command is the basic syntax for taking backup of a single database. Here is an example where the user is logged in to mysql database as a "root" user, "database_name" is the name of the database which you would like to backup and "filedump.sql" is the file name of the mysql backup dump which needs to be created.

 

sudo mysqldump -u root -p database_name > filedump.sql

 

Once you hit this command, it creates the dump file in the same folder where you are currently logged in.

 

Post a Comment

0 Comments