ReWriten MySQL Module for MariaDB

This commit is contained in:
2021-08-18 14:44:35 +02:00
parent 8c033bf7c8
commit bf5d07169d
7 changed files with 24 additions and 173 deletions

24
conf.sh
View File

@@ -1,30 +1,34 @@
###Fetch Config
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MySQL
mrepo=https://git.ictmaatwerk.com/VPS-scripts/MariaDB
mbranch=master
if [ -z ${password+x} ]; then echo 'Error $password is not set' > $OUTPUT 2>&1 ; fi
if [ -z ${PHPMyadmin+x} ]; then echo 'Error $PHPMyadmin is not set, Setting default OFF' > $OUTPUT 2>&1 && PHPMyadmin=0;fi #check if Var is set
if [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] || [ "$shortdist" = "deb11" ] ; then
mv /etc/mysql/debian-start /tmp/debian-start
mv /etc/mysql/debian.cnf /tmp/debian.cnf
fi
rm -rf /etc/mysql/ /etc/my.cnf.d/ /etc/my.cnf
mkdir /etc/mysql/
touch /etc/mysql/my.cnf.fallback
curl --retry 7 --retry-delay 5 -s "$mrepo"/raw/branch/"$mbranch"/config/MySQL/mysqld-V8.cnf -o /etc/mysql/my.cnf
if [ "$shortdist" = "ubu1804" ] || [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] ; then
MYSQLSNAME=mysql
systemctl stop $MYSQLSNAME
sed -i 's#MySQLlog#/var/log/mysql/error.log#g' /etc/mysql/my.cnf
elif [ "$shortdist" = "el8" ]; then
MYSQLSNAME=mysqld
MYSQLSNAME=mariadb
systemctl stop $MYSQLSNAME
if [ "$shortdist" = "ubu2004" ] || [ "$shortdist" = "deb10" ] || [ "$shortdist" = "deb11" ] ; then
sed -i 's#MySQLlog#/var/log/mysql/error.log#g' /etc/mysql/my.cnf
mv /tmp/debian-start /etc/mysql/debian-start
mv /tmp/debian.cnf /etc/mysql/debian.cnf
elif [ "$shortdist" = "el8" ]; then
sed -i 's#MySQLlog#/var/log/mysqld.log#g' /etc/mysql/my.cnf
fi
systemctl start $MYSQLSNAME
systemctl enable $MYSQLSNAME
if [ "$shortdist" = "el8" ]; then
mysql -u root -p$(awk '/A temporary password is generated for/ {a=$0} END{ print a }' /var/log/mysqld.log | awk '{print $(NF)}') --connect-expired-password -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$password'";
fi
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$password'; flush privileges";
if [ $PHPMyadmin = 1 ]; then
mkdir -p /usr/share/phpmyadmin/