diff --git a/backup.sh b/backup.sh
index 92d03937e049a8e673994532e6b7f171dda1a135..506bb9635b0493dda2efaa9d1aaa12d53e49cf0a 100644
--- a/backup.sh
+++ b/backup.sh
@@ -2,6 +2,11 @@
 
 echo "Backing up Keycloak DB and config"
 
+if [ -z "$MARIADB_PASS" ]; then
+  echo "Error: the MARIADB_PASS variable is not set or is empty."
+  exit 1
+fi
+
 if [ ! -d "backups" ]; then
   mkdir "backups"
 fi