snippets > mysql-dumps-via-kubectl

Get MySQL/MariaDB dumps directly from kubectl

kubectl -n <namespace> exec <pod_name> -it -- bash -c 'mysqldump --databases $MYSQL_DATABASE -u$MYSQL_USER -p$MYSQL_PASSWORD' > dump-`date '+%Y_%m_%d__%H_%M_%S'`.sql