Showing posts with label Backup. Show all posts
Showing posts with label Backup. Show all posts

Friday, January 28, 2011

How to take MySQL Database dump

Everyday web application can generate a huge amount of blogs,articles,comments and lots of other different types of data.
All that data is stored in the database. To protect your business/information you should be doing daily/weekly backups.

MySQL dump is a backup solution.It create simple sql file with tables schema and entries(insert queries) of database. Using a MySQL dump you can
easily migrate your website.

Ways to take mysqldump

shell> mysqldump [options] db_name [tbl_name ...]
shell> mysqldump [options] --database db_name ...
shell> mysqldump [options] --all-databases

With --tab and --opt option

mysqldump --tab=/path/to/dump/dir --opt database_name

Examples

Shell> mysqldump -u mysql_user -p database_name > database_name.sql
Shell> mysqldump -u mysql_user -p database_name table_name > table_name.sql