Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chris2k20/c30a0f82443205ee9f9c0e67fab550c6 to your computer and use it in GitHub Desktop.
Save chris2k20/c30a0f82443205ee9f9c0e67fab550c6 to your computer and use it in GitHub Desktop.
Run a mysql_upgrade in all mysql/mariadb docker containers
# run the following command in your terminal to:
# - run a mysql_upgrade command in every container
# - kill the container to restart the mariadb
for x in $(docker ps | grep -i mariadb:latest | awk '{print $1;}'); do echo container $x now updating...; docker exec $x bin/sh -c 'mysql_upgrade --user=root --password=$(printenv MYSQL_ROOT_PASSWORD) ; kill 1'; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment