Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exclude views from mysql database dump

Is there any way to exclude views from mysql dump export?

I tried --ignore-table command. But this command recommand the parameters of table which i want to exclude.

I have 30 views in my database.

Is there any simple way to export only table (not views)?

Thanks

like image 643
Dhinakar Avatar asked Feb 18 '26 03:02

Dhinakar


1 Answers

Based on the answer here, you should be able to pipe the table objects to mysqldump like:

mysql -u username INFORMATION_SCHEMA
  --skip-column-names --batch
  -e "select table_name from tables where table_type = 'BASE TABLE'
      and table_schema = 'database'"
  | xargs mysqldump -u username database
  > tables.sql
like image 184
Digital Chris Avatar answered Feb 20 '26 17:02

Digital Chris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!