Skip to content

Commit d74cda3

Browse files
authored
Merge pull request hestiacp#2430 from hestiacp/fix/2427-installer-mariadb
hestiacp#2427 Adjust installer due to changes MariaDB
2 parents c8161b8 + cddf2e3 commit d74cda3

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

install/hst-install-debian.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,18 +1518,17 @@ if [ "$mysql" = 'yes' ]; then
15181518
systemctl start mysql >> $LOG
15191519
check_result $? "mariadb start failed"
15201520

1521-
# Securing MariaDB installation
1522-
mpass=$(gen_pass)
1523-
mysqladmin -u root password $mpass >> $LOG
1524-
echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
1525-
chmod 600 /root/.my.cnf
1526-
1527-
# Clear MariaDB Test Users and Databases
1528-
mysql -e "DELETE FROM mysql.user WHERE User=''"
1529-
mysql -e "DROP DATABASE test" > /dev/null 2>&1
1530-
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1531-
mysql -e "DELETE FROM mysql.user WHERE user='';"
1532-
mysql -e "DELETE FROM mysql.user WHERE password='' AND authentication_string='';"
1521+
# Ater root password
1522+
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
1523+
# Remove root login from remote servers
1524+
mysql -e "DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
1525+
# Disable anonymous users
1526+
mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
1527+
# Drop test database
1528+
mysql -e "DROP DATABASE IF EXISTS test"
1529+
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%"
1530+
1531+
mysql -e "FLUSH PRIVILEGES;"
15331532
fi
15341533

15351534

install/hst-install-ubuntu.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,13 +1543,19 @@ if [ "$mysql" = 'yes' ]; then
15431543
mysqladmin -u root password $mpass >> $LOG
15441544
echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
15451545
chmod 600 /root/.my.cnf
1546+
1547+
# Ater root password
1548+
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
1549+
# Remove root login from remote servers
1550+
mysql -e "DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
1551+
# Disable anonymous users
1552+
mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
1553+
# Drop test database
1554+
mysql -e "DROP DATABASE IF EXISTS test"
1555+
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%"
1556+
1557+
mysql -e "FLUSH PRIVILEGES;"
15461558

1547-
# Clear MariaDB Test Users and Databases
1548-
mysql -e "DELETE FROM mysql.user WHERE User=''"
1549-
mysql -e "DROP DATABASE test" > /dev/null 2>&1
1550-
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1551-
mysql -e "DELETE FROM mysql.user WHERE user='';"
1552-
mysql -e "DELETE FROM mysql.user WHERE password='' AND authentication_string='';"
15531559
fi
15541560

15551561

0 commit comments

Comments
 (0)