Skip to content

Commit faad587

Browse files
Resolve issue during mysql restart (hestiacp#2446)
* Resolve issue during mysql restart Also resolved access with no access via root user via phpmyadmin * Make blocks equal for both installers Co-authored-by: Raphael <rs@scit.ch>
1 parent e997a6a commit faad587

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

install/hst-install-debian.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,14 +1526,14 @@ if [ "$mysql" = 'yes' ]; then
15261526

15271527
# Ater root password
15281528
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
1529-
# Remove root login from remote servers
1530-
mysql -e "DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
1529+
# Allow mysql access via socket for startup
1530+
mysql -e "UPDATE mysql.global_priv SET priv=json_set(priv, '$.password_last_changed', UNIX_TIMESTAMP(), '$.plugin', 'mysql_native_password', '$.authentication_string', 'invalid', '$.auth_or', json_array(json_object(), json_object('plugin', 'unix_socket'))) WHERE User='root';"
15311531
# Disable anonymous users
15321532
mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
15331533
# Drop test database
15341534
mysql -e "DROP DATABASE IF EXISTS test"
15351535
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1536-
1536+
# Flush privileges
15371537
mysql -e "FLUSH PRIVILEGES;"
15381538
fi
15391539

install/hst-install-ubuntu.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1545,14 +1545,14 @@ if [ "$mysql" = 'yes' ]; then
15451545

15461546
# Ater root password
15471547
mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
1548-
# Remove root login from remote servers
1549-
mysql -e "DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
1548+
# Allow mysql access via socket for startup
1549+
mysql -e "UPDATE mysql.global_priv SET priv=json_set(priv, '$.password_last_changed', UNIX_TIMESTAMP(), '$.plugin', 'mysql_native_password', '$.authentication_string', 'invalid', '$.auth_or', json_array(json_object(), json_object('plugin', 'unix_socket'))) WHERE User='root';"
15501550
# Disable anonymous users
15511551
mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
15521552
# Drop test database
15531553
mysql -e "DROP DATABASE IF EXISTS test"
15541554
mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
1555-
1555+
# Flush privileges
15561556
mysql -e "FLUSH PRIVILEGES;"
15571557
fi
15581558

0 commit comments

Comments
 (0)