Update mysql-install.sh (#123)
Some checks failed
Deploy Next.js site to Pages / build (push) Has been cancelled
Deploy Next.js site to Pages / deploy (push) Has been cancelled

Added the option to install the 8.4 LTS release
This commit is contained in:
davalanche 2024-11-07 12:41:37 -06:00 committed by GitHub
parent 10b2ddf3e0
commit 7a3adeb142
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,9 +24,17 @@ $STD apt-get install -y \
mc
msg_ok "Installed Dependencies"
RELEASE_REPO="mysql-8.0"
RELEASE_AUTH="mysql_native_password"
read -r -p "Would you like to install the MySQL 8.4 LTS release instead of MySQL 8.0 (bug fix track; EOL April-2026)? <y/N> " prompt
if [[ "${prompt,,}" =~ ^(y|yes)$ ]]; then
RELEASE_REPO="mysql-8.4-lts"
RELEASE_AUTH="caching_sha2_password"
fi
msg_info "Installing MySQL"
curl -fsSL https://repo.mysql.com/RPM-GPG-KEY-mysql-2023 | gpg --dearmor -o /usr/share/keyrings/mysql.gpg
echo "deb [signed-by=/usr/share/keyrings/mysql.gpg] http://repo.mysql.com/apt/debian $(lsb_release -sc) mysql-8.0" >/etc/apt/sources.list.d/mysql.list
echo "deb [signed-by=/usr/share/keyrings/mysql.gpg] http://repo.mysql.com/apt/debian $(lsb_release -sc) ${RELEASE_REPO}" >/etc/apt/sources.list.d/mysql.list
$STD apt-get update
export DEBIAN_FRONTEND=noninteractive
$STD apt-get install -y \
@ -36,7 +44,7 @@ msg_ok "Installed MySQL"
msg_info "Configure MySQL Server"
ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)"
$STD mysql -uroot -p"$ADMIN_PASS" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '$ADMIN_PASS'; FLUSH PRIVILEGES;"
$STD mysql -uroot -p"$ADMIN_PASS" -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH $RELEASE_AUTH BY '$ADMIN_PASS'; FLUSH PRIVILEGES;"
echo "" >~/mysql.creds
echo -e "MySQL user: root" >>~/mysql.creds
echo -e "MySQL password: $ADMIN_PASS" >>~/mysql.creds