5ab1a92dcc44639ade2b91bcf06e75fc291d5e05
max
  Tue Mar 1 06:12:19 2022 -0800
another mariadb fix in gbic, refs #28348

diff --git src/product/installer/browserSetup.sh src/product/installer/browserSetup.sh
index f173443..b2e1a27 100755
--- src/product/installer/browserSetup.sh
+++ src/product/installer/browserSetup.sh
@@ -521,30 +521,31 @@
         # Ubuntu 14
     	MYCNF=/etc/mysql/my.cnf
     elif [ -f /etc/mysql/mysql.conf.d/mysqld.cnf ] ; then
 	# Ubuntu 16, 18, 20
     	MYCNF=/etc/mysql/mysql.conf.d/mysqld.cnf
     else
     	echo Could not find my.cnf. Adapt 'setMYCNF()' in browserSetup.sh and/or contact us.
     	exit 1
     fi
     echo Found Mariadb config file: $MYCNF
 }
 
 function mysqlStrictModeOff () 
 {
 # make sure that missing values in mysql insert statements do not trigger errors, #18368 = deactivate strict mode
+# This must happen before Mariadb is started or alternative Mariadb must be restarted after this has been done
 setMYCNF
 sed -Ei '/^.(mysqld|server).$/a sql_mode='  $MYCNF
 }
 
 function mysqlAllowOldPasswords
 # mysql >= 8 does not allow the old passwords anymore. But our client is still compiled
 # with the old, non-SHA256 encryption. So we must deactivate this new feature.
 # What will MariaDB do?
 {
 echo2 'Checking for Mysql version >= 8'
 
 MYSQLMAJ=`mysql -e 'SHOW VARIABLES LIKE "version";' -NB | cut -f2 | cut -d. -f1`
 setMYCNF
 if [ "$MYSQLMAJ" -ge 8 ] ; then
     echo2 'Mysql >= 8 found, checking if default-authentication allows native passwords'
@@ -729,71 +730,72 @@
 
     # this triggers an error if rpmforge is not installed
     # but if rpmforge is installed, we need the option
     # psxy is not that important, we just skip it for now
     #yum -y install GMT hdf5 --disablerepo=rpmforge
     
     if [ -f /etc/init.d/iptables ]; then
        echo2 Opening port 80 for incoming connections to Apache
        waitKey
        iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
        iptables -I INPUT 1 -p tcp --dport 443 -j ACCEPT
        service iptables save
        service iptables restart
     fi
     
-    # MYSQL INSTALL ON REDHAT, quite involved, as MariaDB is increasingly the default
+    # MYSQL INSTALL ON REDHAT
 
     # centos7 provides only a package called mariadb-server
     # Mysql 8 does not allow copying MYISAM files anymore into the DB. 
     # -> we cannot support Mysql 8 anymore
     #if yum list mysql-server 2> /dev/null ; then
        #MYSQLPKG=mysql-server
     if yum list mariadb-server 2> /dev/null ; then
         MYSQLPKG=mariadb-server
     else
         echo2 Cannot find a mysql-server package in the current yum repositories
         exit 100
     fi
     
-    # even mariadb packages currently call their binary /usr/bin/mysqld_safe
+    # even mariadb packages currently call their main wrapper /usr/bin/mysqld_safe
     if [ ! -f /usr/bin/mysqld_safe ]; then
         echo2 
         echo2 Installing the Mysql or MariaDB server and make it start at boot.
         waitKey
 
         moveAwayMyCnf
         yum -y install $MYSQLPKG
     
         # Fedora 20 names the package mysql-server but it actually contains mariadb
         MYSQLD=mysqld
         MYSQLVER=`mysql --version`
         if [[ $MYSQLVER =~ "MariaDB" ]]; then
             MYSQLD=mariadb
         fi
             
         # start mysql on boot
         chkconfig --level 2345 $MYSQLD on 
 
+        # make sure that missing values in Mysql insert statements do not trigger errors, #18368: deactivate strict mode
+        mysqlStrictModeOff
+
         # start mysql now
         /sbin/service $MYSQLD start
 
         secureMysql
         SET_MYSQL_ROOT=1
 
-        # make sure that missing values in Mysql insert statements do not trigger errors, #18368: deactivate strict mode
-        mysqlStrictModeOff
     else
         echo2 Mysql already installed
     fi
 
     # MySQL-python is required for hgGeneGraph
     # CentOS up to and including 7 default to python2, so MySQL-python is in the repos
     if yum list MySQL-python 2> /dev/null ; then
             yum -y install MySQL-python
     # Centos 8 defaults to python3 and it does not have a package MySQL-python anymore
     # So we install python2, the mysql libraries and fix up my_config.h manually
     # This is strange, but I was unable to find a different working solution. MariaDB simply does not have my_config.h
     else
             yum install -y python2 mysql-devel python2-devel wget gcc
             if [ -f /usr/include/mysql/my_config.h ]; then
                     echo my_config.h found
@@ -1025,30 +1027,31 @@
         echo2 Now installing the Mysql server. 
         echo2 The root password will be set to a random string and will be written
         echo2 to the file /root/.my.cnf so root does not have to provide a password on
         echo2 the command line.
         waitKey
         moveAwayMyCnf
 
         # do not prompt in apt-get, will set an empty mysql root password
         export DEBIAN_FRONTEND=noninteractive
 	# Debian / Ubuntu 20 defaults to Mysql 8 and Mysql 8 does not allow rsync of myisam anymore
 	# -> we require mariaDb now
         # apt-get --assume-yes install mysql-server
         apt-get --assume-yes install mariadb-server
 
         mysqlStrictModeOff
+        service mariadb restart
         # flag so script will set mysql root password later to a random value
         SET_MYSQL_ROOT=1
     fi
 
 }
 
 # download apache mysql libpng openssl into the current dir
 # and build them into $APACHEDIR/ext
 function buildApacheMysqlOpensslLibpng () 
 {
 echo2
 echo2 Now building cmake, openssl, pcre, apache and mysql into $APACHEDIR/ext
 echo2 This can take up to 20 minutes on slower machines
 waitKey
 # cmake - required by mysql