Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to dump mysql database?

Tags:

mysqldump

I want to dump mysql database only the tables which have data, Can u please give me your suggestion. this is more helpful

Thanks & Regards, Vara Kumar.PJD

like image 640
varakumar.pjd Avatar asked Sep 16 '10 08:09

varakumar.pjd


People also ask

How do I dump a MySQL database in Windows?

To dump entire databases, do not name any tables following db_name , or use the --databases or --all-databases option. To see a list of the options your version of mysqldump supports, issue the command mysqldump --help.

What is MySQL dump command?

4 mysqldump — A Database Backup Program. The mysqldump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data. It dumps one or more MySQL databases for backup or transfer to another SQL server.


1 Answers

You can use the --ignore-table option, but you have to find out which tables are empty first as this is not directly possible with mysqldump. So you could do

mysqldump -u username -p database --ignore-table=database.table1 --ignore-table=database.table2 > database.sql
like image 179
halfdan Avatar answered Nov 02 '22 15:11

halfdan