Skip to content

Commit 9b18310

Browse files
authored
Fix/mysql broken installs (hestiacp#2452)
* Check if version is 10.6 and unix_socket is not present if not execute * Execute command for real * Improved message + Add check if mysql installed... * Update message
1 parent c5c61c2 commit 9b18310

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

install/upgrade/versions/1.5.10.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# Hestia Control Panel upgrade script for target version 1.5.9
4+
5+
#######################################################################################
6+
####### Place additional commands below. #######
7+
#######################################################################################
8+
####### Pass through information to the end user in case of a issue or problem #######
9+
####### #######
10+
####### Use add_upgrade_message "My message here" to include a message #######
11+
####### in the upgrade notification email. Example: #######
12+
####### #######
13+
####### add_upgrade_message "My message here" #######
14+
####### #######
15+
####### You can use \n within the string to create new lines. #######
16+
#######################################################################################
17+
18+
upgrade_config_set_value 'UPGRADE_UPDATE_WEB_TEMPLATES' 'false'
19+
upgrade_config_set_value 'UPGRADE_UPDATE_DNS_TEMPLATES' 'false'
20+
upgrade_config_set_value 'UPGRADE_UPDATE_MAIL_TEMPLATES' 'false'
21+
upgrade_config_set_value 'UPGRADE_REBUILD_USERS' 'false'
22+
upgrade_config_set_value 'UPGRADE_UPDATE_FILEMANAGER_CONFIG' 'false'
23+
24+
# shellcheck source=/usr/local/hestia/func/db.sh
25+
source $HESTIA/func/db.sh
26+
27+
if [ -n "$(echo $DB_SYSTEM | grep -w mysql)" ]; then
28+
mysql_connect 'localhost'
29+
version=$(mysql --defaults-file=/usr/local/hestia/conf/.mysql.localhost -e 'SELECT VERSION()')
30+
mysql_version=$(echo $version | grep -o -E '[0-9]*.[0-9].[0-9]+' | head -n1);
31+
mysql_version2=$(echo $mysql_version | grep -o -E '[0-9]*.[0-9]' | head -n1 );
32+
33+
if [ "$mysql_version2" = "10.6" ]; then
34+
test=$(mysql -e "select * from mysql.global_priv;" | grep root | grep unix_socket);
35+
if [ -z "$test" ]; then
36+
echo "[ ! ] Updating MariaDB permissions to fix startup issue "
37+
mysql --defaults-file=/usr/local/hestia/conf/.mysql.localhost -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';"
38+
fi
39+
fi
40+
fi

0 commit comments

Comments
 (0)