Taking MySQL database backup in Linux - Quick Command


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.

 

Follow Me on Social Media

Advertisement
FREE Sales CRM Software

Fully customizable CRM Software for Freelancers and Small Businesses

Signup for Free

Sign up for DigitalOcean Cloud

Get FREE $200 credits, deploy your hobby projects for Free

DigitalOcean Referral Badge
Sign up for Hostinger Cloud or VPS plans and get upto 20% Discount