mirror of
https://github.com/Crosstalk-Solutions/project-nomad.git
synced 2026-03-28 03:29:25 +01:00
fix(install): prevent MySQL credential mismatch on reinstall
When the install script runs a second time (e.g., after a failed first attempt), it generates new random database passwords and writes them to compose.yml. However, MySQL only initializes credentials on first startup when its data directory is empty. If /opt/project-nomad/mysql/ persists from the previous attempt, MySQL skips initialization and keeps the old passwords, causing "Access denied" errors for nomad_admin. Fix: remove the MySQL data directory before generating new credentials so MySQL reinitializes with the correct passwords. Closes #404 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
5e93f2661b
commit
f00bfff77c
|
|
@ -403,6 +403,15 @@ download_management_compose_file() {
|
||||||
local db_root_password=$(generateRandomPass)
|
local db_root_password=$(generateRandomPass)
|
||||||
local db_user_password=$(generateRandomPass)
|
local db_user_password=$(generateRandomPass)
|
||||||
|
|
||||||
|
# If MySQL data directory exists from a previous install attempt, remove it.
|
||||||
|
# MySQL only initializes credentials on first startup when the data dir is empty.
|
||||||
|
# If stale data exists, MySQL ignores the new passwords above and uses the old ones,
|
||||||
|
# causing "Access denied" errors when the admin container tries to connect.
|
||||||
|
if [[ -d "${NOMAD_DIR}/mysql" ]]; then
|
||||||
|
echo -e "${YELLOW}#${RESET} Removing existing MySQL data directory to ensure credentials match...\\n"
|
||||||
|
sudo rm -rf "${NOMAD_DIR}/mysql"
|
||||||
|
fi
|
||||||
|
|
||||||
# Inject dynamic env values into the compose file
|
# Inject dynamic env values into the compose file
|
||||||
echo -e "${YELLOW}#${RESET} Configuring docker-compose file env variables...\\n"
|
echo -e "${YELLOW}#${RESET} Configuring docker-compose file env variables...\\n"
|
||||||
sed -i "s|URL=replaceme|URL=http://${local_ip_address}:8080|g" "$compose_file_path"
|
sed -i "s|URL=replaceme|URL=http://${local_ip_address}:8080|g" "$compose_file_path"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user