Created
April 24, 2022 16:33
-
-
Save misterebs/58806e4e5fdc4fd75f696f931228bdf6 to your computer and use it in GitHub Desktop.
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 | |
echo "Dumping all databases" | |
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin --verbose --all-databases --routines --triggers > /tmp/all-databases.sql 2&> /dev/null | |
#avoid inconsistency with repo if one exists | |
if [ -f "/etc/yum.repos.d/MariaDB.repo" ] ; then | |
mv /etc/yum.repos.d/MariaDB.repo /etc/yum.repos.d/mariadb.repo | |
fi | |
#Stopping MariaDB | |
echo "stopping MariaDB service" | |
systemctl stop mariadb | |
echo "creating backup of mysql directory" | |
cp -v -a /var/lib/mysql/ /var/lib/mysql_backup 2&> /dev/null | |
echo "removing mysql-server package in case it exists" | |
rpm -e --nodeps "`rpm -q --whatprovides mysql-server`" | |
echo "Upgrading MariaDB" | |
echo "#http://downloads.mariadb.org/mariadb/repositories/ | |
[mariadb] | |
name = MariaDB | |
baseurl = http://yum.mariadb.org/10.5/centos7-amd64 | |
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB | |
gpgcheck=1" > /etc/yum.repos.d/mariadb.repo | |
yum install MariaDB-client MariaDB-server MariaDB-compat MariaDB-shared -y | |
systemctl restart mariadb | |
MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin | |
systemctl restart mariadb | |
echo "Informing Plesk of the changes (plesk sbin packagemng -sdf)" | |
plesk sbin packagemng -sdf | |
systemctl start mariadb # to start MariaDB if not started | |
systemctl enable mariadb # to make sure that MariaDB will start after the server |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment