A minor adventure, yet one worth documenting. I’ve been wanting to get MariaDB updated on my VPS for the longest of time but do it in a way with precompiled binaries so I have some control over what I run and, if needed, some flexibility with versions without having to dnf
/yum
/apt-get
things in and out.
To note I tested this on my test machine running 4.18.0-348
and it wasn’t quite happy with getting 11.8.2
rolled out onto it. I realized that the home test machine is a bit old so I had to defer to 10.11.13
. Once that was all done I fired up a virtual Rocky9 host running 5.14.0-*
and, with the same instructions with the test machine successfully got 11.8.2
slammed on that with no data loss.
Prerequisites
Grabbing the 11.8.2 binary was the first bit of ease. Extracting it had some good instructions in INSTALL-BINARY
, but these could only take me so far since they assumed it was a fresh install.
INSTALL-BINARY: Revised
The better instructions for upgrading an already-installed system pretty much came down to:
shell> #groupadd mysql (do not need to do)
shell> #useradd -g mysql mysql (do not need to do)
shell> cd /usr/local
shell> gunzip < /path/to/mariadb-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mariadb-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
#----- Don't do below -----
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
shell> bin/mysqld_safe --user=mysql &
#----- Instead, do the following -----
sudo systemctl stop mysqld
# database is still in /var/lib/mysql
sudo mkdir data
cd data
sudo cp -R /var/lib/mysql/* .
cd ..
sudo chown -R root .
sudo chown -R mysql data
sudo yum remove mariadb-server
# Above gives me no my.cnf, so I'll need to manually copy from /etc/my.cnf.d to /etc/my.cnf and remark out everything except socket= and log-error=
# Swapping out systemd service
sudo ln -s /usr/local/mysql/support-files/systemd/mysql.service /etc/systemd/system/mysql.service
sudo ln -s /usr/local/mysql/support-files/systemd/mysqld.service /etc/systemd/system/mysqld.service
sudo systemctl daemon-reload
sudo systemctl start mysqld
sudo ./bin/mariadb-upgrade
No explanation, really. This process from top/down helped for both kernels and now I’m updated and happy.