#!/bin/bash
#Configure MySQL
rm -rf /etc/mysql/ /etc/my.cnf.d/ /etc/my.cnf
mkdir /etc/mysql/
touch /etc/mysql/my.cnf.fallback
mv /opt/Setup/Configs/my.cnf /etc/mysql/my.cnf

#Setup PhpMyAdmin
mkdir /opt/PhpMyAdmin
tar -C /opt/PhpMyAdmin -xzf /opt/Setup/phpmyadmin.tar.gz --strip 1
rm -rf /opt/Setup/phpmyadmin.tar.gz
mv /opt/Setup/Configs/config.inc.php /opt/PhpMyAdmin/config.inc.php
mv /opt/Setup/Configs/phpmyadmin.service /etc/systemd/system/phpmyadmin.service
chmod +x /etc/systemd/system/phpmyadmin.service
ln -s /etc/systemd/system/phpmyadmin.service /etc/systemd/system/multi-user.target.wants/phpmyadmin.service