In this guide, we shall indicate two methods of upgrading a database
Method 1: Automated upgrade script. The script will handle everything for you including backups.
Using the convenience script.
wget -qO- https://raw.githubusercontent.com/dannydev77/database_upgrade_utility_script/main/database_upgrade.sh | bash
Method 2: Manual – This section provide step by step actions.
Before you begin the upgrade ensure to take a backup of your data in case something goes wrong.
mariadb --version
Backup.
Take a full database backup using either of the commands below.
mysqldump --events --all-databases | gzip > /home/alldatabases.sql.gz
Stop the database server and Remove MariaDB
systemctl stop mariadb systemctl status mariadb
To confirm which packages will be removed, run
apt list --installed | grep -i -E "mariadb|galera"
To remove run,
apt remove "*mariadb*" "galera*" -y
To confirm all those packages were removed
apt list --installed | grep -i -E "mariadb|galera"
Install New Version of MariaDB
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version="mariadb-10.6"
Update the system
apt update -y
Install mariadb
apt install mariadb-server libmariadb-dev -y
run apt update && apt upgrade -y to update all packages again
apt update && apt upgrade -y
enable the mariadb service
systemctl enable mariadb
Start the database server
systemctl start mariadb.service
Complete the upgrade.
Run the mariadb-upgrade script utility
mariadb-upgrade -u root -p --force