https://bugs.koozali.org/show_bug.cgi?id=13593

            Bug ID: 13593
           Summary: mysql.init errors
    Classification: Contribs
           Product: SME Contribs
           Version: 11.0
          Hardware: ---
                OS: ---
            Status: CONFIRMED
          Severity: normal
          Priority: P3
         Component: smeserver-zabbix-server
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
  Target Milestone: ---

Jun 12 16:12:37 rocky8 mysql.init[1481395]: --------------
Jun 12 16:12:37 rocky8 mysql.init[1481395]: RENAME TABLE history TO history_old
Jun 12 16:12:37 rocky8 mysql.init[1481395]: --------------
Jun 12 16:12:37 rocky8 mysql.init[1481395]:
Jun 12 16:12:37 rocky8 mysql.init[1481395]: ERROR 1050 (42S01) at line 1: Table
'history_old' already exists
Jun 12 16:12:37 rocky8 mysql.init[1481395]: --------------
Jun 12 16:12:37 rocky8 mysql.init[1481395]: update users set
passwd='y0.ttH.ekoIoQjzbE5WL2Vwj3dPatoVjOO' where alias='Admin'
Jun 12 16:12:37 rocky8 mysql.init[1481395]: --------------
Jun 12 16:12:37 rocky8 mysql.init[1481395]:
Jun 12 16:12:37 rocky8 mysql.init[1481395]: ERROR 1054 (42S22) at line 4:
Unknown column 'alias' in 'WHERE'
Jun 12 16:12:37 rocky8 mysql.init[1481356]: Loading zabbix-server into mariadb
[  OK  ]




column alias is now username ....

TARGET_COL=$(mariadb  $db -N -B -e "
    SELECT COLUMN_NAME 
    FROM information_schema.COLUMNS 
    WHERE TABLE_SCHEMA = '$db' 
      AND TABLE_NAME = 'users' 
      AND COLUMN_NAME IN ('alias', 'username') 
    LIMIT 1;
")

# Check if a column was found, then execute the update
if [ -n "$TARGET_COL" ]; then
    echo "Found column: $TARGET_COL. Updating password..."

    mariadb "$db" -e "
        UPDATE users SET passwd = '$hashpass' WHERE $TARGET_COL = 'Admin';
    "
fi


ERROR 1050 (42S01) at line 1: Table 'history_old' already exists this is noise


# 1. Check if history_old already exists
TABLE_EXISTS=$(mariadb $db -N -B -e "
    SELECT 1 
    FROM information_schema.TABLES 
    WHERE TABLE_SCHEMA = '$db' 
      AND TABLE_NAME = 'history_old';
")

# 2. Only execute the SQL file if the table was NOT found
if [ -z "$TABLE_EXISTS" ]; then

fi

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
_______________________________________________
Mail for each SME Contribs bug report
To unsubscribe, e-mail [email protected]
Searchable archive at https://lists.contribs.org/mailman/public/contribteam/

Reply via email to