From 85d2ffafd97918f21ebcae12947a9930df45703b Mon Sep 17 00:00:00 2001 From: emorino Date: Fri, 8 Feb 2019 10:59:35 +0100 Subject: [PATCH] Ajour exclure VIEWS mysqldump --- HowtoMySQL.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/HowtoMySQL.md b/HowtoMySQL.md index d7bff110..756e98a7 100644 --- a/HowtoMySQL.md +++ b/HowtoMySQL.md @@ -874,6 +874,14 @@ Et pour sauvegarder des tables correspondant à un motif (préfixe le plus souve $ mysqldump --hex-blob foo $(mysql foo -B --column-names=False -e "show tables like 'exemple_%'") > foo_motif.sql ~~~ +Pour exclure les VIEWS d'un mysqldump : + +~~~ +EXCLUDE_VIEWS=$(echo "SELECT TABLE_SCHEMA, TABLE_NAME from INFORMATION_SCHEMA.VIEWS" | mysql information_schema | sed '/^TABLE_SCHEMA/d' | gawk {'print $1"." $2'} |tr '\n' ',') + +mysqldump --opt --all-databases --force --ignore-table=$EXCLUDE_VIEWS --events --hex-blob > foo.sql +~~~ + Pour dumper avec une condition particulière : ~~~