Monday, November 19, 2007

Create a MySQL dump for a database

How to create a MySQL dump for multiple tables in a database?

Syntax:

mysqldump db_name tb_name1 tb_name2 ... tb_namen > file_name_to_save

Examples:

mysqldump carriermls_production users user_search_results > users_backup.sql
mysql carriermls_tmp < users_backup.sql

If you doesnt mentioned any name in tables option, you can dump entire database itself.

If you want to dump all mysql databases means, use the below commands:
mysqldump [options] --all-databases

mysqldump [options] --databases db_name1 [db_name2 db_name3...]