Page 1 of 1

updating host name - SQL syntax Error

Posted: 14 Apr 2016 02:03
by zane93
I updated the host name and received this message right before it reboot(domain name hidden). It seems to have worked at first glance but I have no idea how deep it goes into other configurations. Running latest updates.

Code: Select all

Are you sure you want to change the hostname of this machine
[EFA] to edge.XXXXX.XXX? (y/N): y
Shutting down MailScanner daemons:
         MailScanner:                                      [  OK  ]
         incoming postfix:                                 [  OK  ]
         outgoing postfix:                                 [  OK  ]
/var/EFA/lib/EFA-Configure/func_sethostname: line 74: timestamp: command not found
/var/EFA/lib/EFA-Configure/func_sethostname: line 74: timestamp: command not found
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL DEFAULT CURRENT_TIMESTAMP' at line 1

Hostname changed
Here is the code in the func_sethostname file lines 74-82.

Code: Select all

    mysql -u mailwatch --password=$MAILWATCHPWD mailscanner -e "\
    LOCK TABLES maillog WRITE; \
    ALTER TABLE maillog MODIFY COLUMN `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP; \
    UPDATE maillog SET hostname='$HOSTNAME.$DOMAINNAME' WHERE hostname='$OLDHOSTNAME.$OLDDOMAINNAME'; \
    ALTER TABLE maillog MODIFY COLUMN `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP; \
    UNLOCK TABLES maillog; \
    LOCK TABLES mtalog WRITE; \
    UPDATE mtalog SET host='$HOSTNAME' WHERE host='$OLDHOSTNAME'; \
    UNLOCK TABLES mtalog;"

Re: updating host name - SQL syntax Error

Posted: 17 Apr 2016 14:32
by shawniverson
Checking...

Re: updating host name - SQL syntax Error

Posted: 17 Apr 2016 14:41
by shawniverson
Confirmed.

Re: updating host name - SQL syntax Error

Posted: 17 Apr 2016 14:42
by shawniverson

Re: updating host name - SQL syntax Error

Posted: 20 Apr 2016 12:59
by zane93
Thanks for the fix!