diff --git a/mariadb/templates/monitoring/prometheus/bin/_create-mysql-user.sh.tpl b/mariadb/templates/monitoring/prometheus/bin/_create-mysql-user.sh.tpl index 85b30ce77..594880fa6 100644 --- a/mariadb/templates/monitoring/prometheus/bin/_create-mysql-user.sh.tpl +++ b/mariadb/templates/monitoring/prometheus/bin/_create-mysql-user.sh.tpl @@ -18,7 +18,10 @@ limitations under the License. set -e -mysql --defaults-file=/etc/mysql/admin_user.cnf -e \ +if ! mysql --defaults-file=/etc/mysql/admin_user.cnf -e \ "CREATE OR REPLACE USER '${EXPORTER_USER}'@'%' IDENTIFIED BY '${EXPORTER_PASSWORD}'; \ GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO '${EXPORTER_USER}'@'%'; \ - FLUSH PRIVILEGES;" + FLUSH PRIVILEGES;" ; then + echo "ERROR: Could not create user: ${EXPORTER_USER}" + exit 1 +fi