Replacing the stock MariaDB/MySQL version in VestaCP with a newer version.
I updated mine because I wanted to use the JSON data type.
CentOS users can choose any version on this page: https://yum.mariadb.org/
Ubuntu/Debian users can choose any version on this page: https://archive.mariadb.org/
For this example we are using 10.6, if you want a different version, just replace the VERSION_NUM=’10.x’ near the top of the script.
RUN AS ROOT
CentOS/RHEL
VERSION_NUM='10.6'
service mariadb stop
yum remove mariadb mariadb-server -y
echo '
# MariaDB 10.x CentOS repository list
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = https://yum.mariadb.org/'${VERSION_NUM}'/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1' > /etc/yum.repos.d/mariadb.repo
yum install MariaDB-server MariaDB-client -y
service mariadb start
mysql_upgrade
RUN AS ROOT
UBUNTU/DEBIAN
VERSION_NUM='10.6.0'
DISTRO=ubuntu
apt update -y
apt install software-properties-common -y
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 F1656F24C74CD1D8
add-apt-repository "deb [arch=amd64] https://archive.mariadb.org/mariadb-${VERSION_NUM}/repo/${DISTRO}/ $(lsb_release --short --codename) main"
apt update -y
apt upgrade -y
systemctl disable mysql
systemctl stop mysql
apt install mariadb-server -y
apt install mariadb-common mariadb-server -y
systemctl enable --now mariadb
mysql_upgrade --force
After running that script, your MariaDB will be updated to the newer version, enjoy!

