Kaif Khan
Kaif Khan

Reputation: 219

How to export mysql database through command line, but ignore some specific table

I have a large MySQL database its almost 434 tables. I would like the export the database but ignore or skip a couple of tables. This process should be done through command line, because i have more than 6 GB+ data in database. What is the proper syntax to export all tables, but ignore some specific of them?

mysqldump -u root -p database directory table1 table2 table2 > /var/www/mydb_tables.sql

This query is working fine, but its difficulty to mention all the 434+ table name. I want the query that skip only specific table and export remaining all table through command line.

Upvotes: 0

Views: 560

Answers (1)

Bhavya Shaktawat
Bhavya Shaktawat

Reputation: 2512

You can use --ignore-table to skip certain tables.

 mysqldump -u username -p database --ignore-table=database.table1 --ignore-table=database.table2 > /var/www/mydb_tables.sql

Upvotes: 2

Related Questions