How To Backup and Email Your Blog MySQL Database From Command Prompt?
Posted By Keith Dsouza On September 18, 2008 @ 11:17 pm In Tips And Tricks | 1 Comment
Backups [1] are the way of keeping your data safe and secure from disasters, and those include your personal data as well your blog database where you have been writing for days, months or years.
We have always opted for hosting providers that provide us access to Shell interfaces using which we can use putty to manage our website, this not only puts us in a better and more comfortable interface but also allows us to use CLI (command line interface) which we are pretty much comfortable with.

Once such useful command we are going to talk about is the use of CLI to backup [1] and email your blog database in just a minute, without the hassle of multiple clicks and page loads. The command to backup your blog database from the command line is: mysqldump -u username -purpassword db_name > latest_backup_091808.sql.
In the above command mysqldump is command provided to dump your entire database to the console or to a file, the param switches are explained below;
If you have written tons of posts, your output file will be of a huge size, so it would be better if you use a archiver to compress the file, use the command gzip latest_backup_091808.sql to compress the file, the output file be named latest_backup_091808.sql.
The final step would be to either download the file using FTP or email it to a email id using CLI. You could easily setup a shell script to run as a cronjob at regular intervals to backup your database with ease, and yes it takes less than a minute if your blog runs on a good server.
What do you think about this tutorial? Do share it among your friends and give us your views on it.
Article printed from Techie Buzz: http://techie-buzz.com
URL to article: http://techie-buzz.com/tips-and-tricks/how-to-backup-and-email-your-blog-mysql-database-from-command-prompt.html
URLs in this post:
[1] Backups: http://techie-buzz.com/tag/backup
Click here to print.
Copyright © 2006-20011 Techie Buzz. All rights reserved.