Skip to content

Modular logistics and supply chain operating system (LSOS)

fix(install): grant bundled DB user privileges to create sandbox DB

Ronald A. Richardson77bfd081282e
diff --git a/scripts/docker-install.sh b/scripts/docker-install.sh
index 30429591..9de6526b 100755
--- a/scripts/docker-install.sh
+++ b/scripts/docker-install.sh
@@ -496,6 +496,22 @@ else
fi
success "Database is ready"
+###############################################################################
+# STEP 12b — Grant privileges for the bundled database
+###############################################################################
+# The bundled MySQL grants the app user (DB_USERNAME) privileges on the primary
+# database only. deploy.sh also provisions a separate sandbox database
+# (fleetbase_sandbox) via `php artisan sandbox:migrate`, which requires the
+# CREATE privilege at the server level. Grant it here using the root credentials
+# generated above so the limited app user can create/manage the sandbox DB.
+if [[ "$DB_MODE" == "internal" ]]; then
+ section "Granting Database Privileges"
+ docker compose exec -T "$DB_SERVICE" \
+ mysql -uroot -p"${DB_ROOT_PASSWORD}" \
+ -e "GRANT ALL PRIVILEGES ON *.* TO '${DB_USERNAME}'@'%'; FLUSH PRIVILEGES;"
+ success "Privileges granted to '${DB_USERNAME}'"
+fi
+
###############################################################################
# STEP 13 — Run deploy script
###############################################################################