1
0
mirror of https://github.com/tommytran732/Pterodactyl-Script synced 2024-11-09 05:01:33 -05:00

Fix MySQL binding and detection improvement

Fixed MySQL binding on debian style and upstream configs 10.4 onwards and improved config file detection
This commit is contained in:
Sagnik Sasmal 2020-09-11 15:19:25 +05:30 committed by GitHub
parent 161d001b0a
commit 8bf988cff9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -531,28 +531,27 @@ install_pterodactyl() {
mysql -u root -e "$SQL" mysql -u root -e "$SQL"
output "Binding MariaDB/MySQL to 0.0.0.0." output "Binding MariaDB/MySQL to 0.0.0.0."
if [ -f /etc/mysql/mariadb.conf.d/50-server.cnf ] ; then if [ -f /etc/mysql/mariadb.conf.d/50-server.cnf && grep -Fq "bind-address" /etc/mysql/mariadb.conf.d/50-server.cnf ] ; then
sed -i -- 's/bind-address/# bind-address/g' /etc/mysql/mariadb.conf.d/50-server.cnf sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/mariadb.conf.d/50-server.cnf
sed -i '/\[mysqld\]/a bind-address = 0.0.0.0' /etc/mysql/mariadb.conf.d/50-server.cnf
output 'Restarting MySQL process...' output 'Restarting MySQL process...'
service mysql restart service mysql restart
elif [ -f /etc/mysql/my.cnf ] ; then elif [ -f /etc/mysql/my.cnf && grep -Fq "bind-address" /etc/mysql/my.cnf ] ; then
sed -i -- 's/bind-address/# bind-address/g' /etc/mysql/my.cnf sed -i -- 's/bind-address/# bind-address/g' /etc/mysql/my.cnf
sed -i '/\[mysqld\]/a bind-address = 0.0.0.0' /etc/mysql/my.cnf sed -i '/\[mysqld\]/a bind-address = 0.0.0.0' /etc/mysql/my.cnf
output 'Restarting MySQL process...' output 'Restarting MySQL process...'
service mysql restart service mysql restart
elif [ -f /etc/my.cnf ] ; then elif [ -f /etc/my.cnf && grep -Fq "bind-address" /etc/my.cnf ] ; then
sed -i -- 's/bind-address/# bind-address/g' /etc/my.cnf sed -i -- 's/bind-address/# bind-address/g' /etc/my.cnf
sed -i '/\[mysqld\]/a bind-address = 0.0.0.0' /etc/my.cnf sed -i '/\[mysqld\]/a bind-address = 0.0.0.0' /etc/my.cnf
output 'Restarting MySQL process...' output 'Restarting MySQL process...'
service mysql restart service mysql restart
elif [ -f /etc/mysql/my.conf.d/mysqld.cnf ] ; then elif [ -f /etc/mysql/my.conf.d/mysqld.cnf && grep -Fq "bind-address" /etc/mysql/my.conf.d/mysqld.cnf ] ; then
sed -i -- 's/bind-address/# bind-address/g' /etc/mysql/my.conf.d/mysqld.cnf sed -i -- 's/bind-address/# bind-address/g' /etc/mysql/my.conf.d/mysqld.cnf
sed -i '/\[mysqld\]/a bind-address = 0.0.0.0' /etc/mysql/my.conf.d/mysqld.cnf sed -i '/\[mysqld\]/a bind-address = 0.0.0.0' /etc/mysql/my.conf.d/mysqld.cnf
output 'Restarting MySQL process...' output 'Restarting MySQL process...'
service mysql restart service mysql restart
else else
output 'File my.cnf was not found! Please contact support.' output 'A MySQL configuration file could not be detected! Please contact support.'
fi fi
output "Downloading Pterodactyl..." output "Downloading Pterodactyl..."