Browse Source

Resolve issue during mysql restart (#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 <[email protected]>
Jaap Marcus 4 years ago
parent
commit
faad587fa0
2 changed files with 6 additions and 6 deletions
  1. 3 3
      install/hst-install-debian.sh
  2. 3 3
      install/hst-install-ubuntu.sh

+ 3 - 3
install/hst-install-debian.sh

@@ -1526,14 +1526,14 @@ if [ "$mysql" = 'yes' ]; then
     
     
     # Ater root password
     # Ater root password
     mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
     mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
-    # Remove root login from remote servers 
-    mysql -e "DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
+    # Allow mysql access via socket for startup
+    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';"
     # Disable anonymous users
     # Disable anonymous users
     mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
     mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
     # Drop test database
     # Drop test database
     mysql -e "DROP DATABASE IF EXISTS test"
     mysql -e "DROP DATABASE IF EXISTS test"
     mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
     mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
-    
+    # Flush privileges
     mysql -e "FLUSH PRIVILEGES;"
     mysql -e "FLUSH PRIVILEGES;"
 fi
 fi
 
 

+ 3 - 3
install/hst-install-ubuntu.sh

@@ -1545,14 +1545,14 @@ if [ "$mysql" = 'yes' ]; then
     
     
     # Ater root password
     # Ater root password
     mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
     mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED BY '$mpass'; FLUSH PRIVILEGES;"
-    # Remove root login from remote servers 
-    mysql -e "DELETE FROM mysql.global_priv WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
+    # Allow mysql access via socket for startup
+    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';"
     # Disable anonymous users
     # Disable anonymous users
     mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
     mysql -e "DELETE FROM mysql.global_priv WHERE User='';"
     # Drop test database
     # Drop test database
     mysql -e "DROP DATABASE IF EXISTS test"
     mysql -e "DROP DATABASE IF EXISTS test"
     mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
     mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
-    
+    # Flush privileges
     mysql -e "FLUSH PRIVILEGES;"
     mysql -e "FLUSH PRIVILEGES;"
 fi
 fi