Mysql Database Backup Options

Last updated on May 5th, 2016 at 01:13 am

MYSQL database backup and restore, Taking mysql database backups are always crucial now a days as daily and weekly backups are always recommended. We are using mysqldump command here to take the backups and also to restore them. Please find the steps below on how to take MYSQL database backup and restore using command line.


USERNAME -> Your database user name
PWD -> Your database password
DATABASE_NAME -> Your database name

For example if i have a database name MYDATA and username as root and password as root123 then the command will look like

#mysqldump -u root -p root123 MYDATA > MYDATA_BACKUP.sql

It is not recommended to provide password in one single command. You can use the command like the one shown below and once the password is prompted you can provide that.
By doing this you are not saving any password in the user command history and no one else can see the password. So it is a security feature and it is always up to you to decide how to go forward with that.

#mysqldump -u root -p MYDATA > MYDATA_BACKUP.sql
Enter Password:

Leave a Reply

Your email address will not be published. Required fields are marked *