Update lxc/setup_mariadb.sh
This commit is contained in:
@ -79,21 +79,33 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# 3. DB 계정 설정
|
# 3. DB 계정 설정 (수정됨)
|
||||||
############################################
|
############################################
|
||||||
read_input "MariaDB 계정을 Linux 계정과 동일하게 사용할까요? (Y/n): " SAME_ACCOUNT
|
read_input "MariaDB 계정을 Linux 계정과 동일하게 사용할까요? (Y/n): " SAME_ACCOUNT
|
||||||
SAME_ACCOUNT=${SAME_ACCOUNT:-Y}
|
SAME_ACCOUNT=${SAME_ACCOUNT:-Y}
|
||||||
|
|
||||||
if [[ "$SAME_ACCOUNT" =~ ^[Yy]$ ]]; then
|
if [[ "$SAME_ACCOUNT" =~ ^[Yy]$ ]]; then
|
||||||
DB_USER="$LINUX_USER"
|
DB_USER="$LINUX_USER"
|
||||||
DB_PW="$LINUX_PW"
|
|
||||||
|
# 기존 Linux 사용자 재사용 시 → DB 비밀번호를 새로 입력
|
||||||
|
if [ -z "${LINUX_PW:-}" ]; then
|
||||||
|
while true; do
|
||||||
|
read_input "MariaDB 비밀번호: " DB_PW true
|
||||||
|
read_input "MariaDB 비밀번호 확인: " DB_PW_CONFIRM true
|
||||||
|
[ "$DB_PW" = "$DB_PW_CONFIRM" ] && break
|
||||||
|
echo "❌ MariaDB 비밀번호가 일치하지 않습니다."
|
||||||
|
done
|
||||||
|
else
|
||||||
|
# 새 Linux 사용자 생성 케이스
|
||||||
|
DB_PW="$LINUX_PW"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
read_input "MariaDB 사용자 이름: " DB_USER
|
read_input "MariaDB 사용자 이름: " DB_USER
|
||||||
while true; do
|
while true; do
|
||||||
read_input "MariaDB 비밀번호: " DB_PW true
|
read_input "MariaDB 비밀번호: " DB_PW true
|
||||||
read_input "비밀번호 확인: " DB_PW_CONFIRM true
|
read_input "MariaDB 비밀번호 확인: " DB_PW_CONFIRM true
|
||||||
[ "$DB_PW" = "$DB_PW_CONFIRM" ] && break
|
[ "$DB_PW" = "$DB_PW_CONFIRM" ] && break
|
||||||
echo "❌ 비밀번호 불일치"
|
echo "❌ MariaDB 비밀번호가 일치하지 않습니다."
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user