I want to back up only the Views with mysqldump.
Is this possible?
If so, how?
I modified Andomar's excellent answer to allow the database (and other settings) to only be specified once:
#!/bin/bash -e
mysql --skip-column-names --batch -e \
"select table_name from information_schema.views \
where table_schema = database()" $* |
xargs --max-args 1 mysqldump $*
I save this as mysql-dump-views.sh and call it via:
$ mysql-dump-views.sh -u user -ppassword databasename >dumpfile.sql