#!/bin/bash

# Update the system
yum update -y

# Install MySQL Server
# Note: On Amazon Linux 2023, use mariadb105-server or mysql-community-server repository if added
yum install -y mariadb105-server || yum install -y mysql-server

# Start and enable MySQL Service
systemctl start mysqld
systemctl enable mysqld

# Optional: Secure installation (usually requires interactive input, so skipped in non-interactive user-data)
# or setup a default user/password via SQL commands here if needed.
