mysqldump –ignore-databases 2


With mysqldump it is not possible by the parameters to exclude individual databases. However, the database can be easily queried from the information_schema and this makes an exclude.
mysqldump --databases `mysql --skip-column-names -e "SELECT GROUP_CONCAT(schema_name SEPARATOR ' ') FROM information_schema.schemata WHERE schema_name NOT IN ('mysql','performance_schema','information_schema', 'db_test');"` >/dump.sql

Thanks to Ronald Bradford


Leave a comment

Your email address will not be published. Required fields are marked *

2 thoughts on “mysqldump –ignore-databases

  • hacmal

    ich habe mich zuerst als mysql eingeloggt und dann den code kopiert und enter gedrückt, doch dann erwartet es noch irgendeine Angabe von mir. aber keine ahnung, was ich da eingeben sollte?

    • Florian Schaal Post author

      Do not run this command within mysql. mysqldump dumps the data without login into mysql.