Created
April 12, 2025 05:01
-
-
Save ManotLuijiu/d3f0ef43d6f3165b15d86867596bd496 to your computer and use it in GitHub Desktop.
Purge MariaDB from Ubuntu 24.04 and Re-Install Scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
echo "π¨ Stopping and removing existing MariaDB..." | |
sudo systemctl stop mariadb || true | |
sudo apt remove --purge mariadb-server mariadb-client mariadb-common mariadb-server-core-* mariadb-client-core-* -y | |
sudo apt autoremove -y | |
sudo apt autoclean -y | |
echo "π§Ή Removing residual config/data (optional)..." | |
sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql /var/log/mysql.* | |
echo "π Installing dependencies..." | |
sudo apt install -y software-properties-common dirmngr gnupg curl | |
echo "π Adding MariaDB 10.6 repo (using jammy for Ubuntu 24.04)..." | |
sudo curl -LsS https://mariadb.org/mariadb_release_signing_key.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/mariadb.gpg > /dev/null | |
echo "deb [signed-by=/etc/apt/trusted.gpg.d/mariadb.gpg] https://mirror.xtom.com.hk/mariadb/repo/10.6/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/mariadb.list | |
echo "π Updating package list..." | |
sudo apt update | |
echo "π¦ Installing MariaDB 10.6..." | |
sudo apt install mariadb-server mariadb-client -y | |
echo "β Enabling and starting MariaDB..." | |
sudo systemctl enable mariadb | |
sudo systemctl start mariadb | |
echo "π Running mysql_secure_installation..." | |
sudo mysql_secure_installation | |
echo "β MariaDB installed successfully:" | |
mysql --version | |
echo "π You can now run 'bench new-site yoursite.com' again!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment