Can I get a dump of all my databases *except one* using mysqldump?
echo 'show databases;' | mysql -uroot -proot | grep -v ^Database$ | grep -v ^information_schema$ | grep -v ^mysql$ | grep -v -F db1 | xargs mysqldump -uroot -proot --databases > all.sql
dumps all databases except: mysql
, information_schema
, mysql
and db1
.
Or if you'd like to review the list before dumping:
echo 'show databases;' | mysql -uroot -proot > databases.txt
- edit
databases.txt
and remove any you don't want to dump cat databases.txt | xargs mysqldump -uroot -proot --databases > all.sql