Website Scripts And Cloud Tutorials

How to take MySql database backup and compress in single command


Apr 19, 2013

Last updated on February 21st, 2022 at 06:54 pm

Click to rate this tutorial!
[Total: 0 Average: 0]

MySql database backup compress in single command.

This is a simple and quick tutorial on how to take mysql database backup and compress the backup sql file in a single command.

This is how it looks

mysqldump -u <user_name> -p<password> <database_name>|gzip > "<directory_to_copy_the_compressed_file>/<file_name>"

For example let us say USER_NAME=root, PASSWORD=root, DATABASE_NAME=mydata, DIRECTORY_TO_COPY_THE_COMPRESSED_FILE=/tmp/databasebackup & FILE_NAME=mydata.sql.gz

Then the command will look like this

mysqldump -u root -proot > mydata|gzip > "/tmp/databasebackup/mydata.sql.gz"

Hope this helps you to take mysql backups at least once every month .

Click to rate this tutorial!
[Total: 0 Average: 0]

Leave a Reply

Your email address will not be published.