updating host name - SQL syntax Error

Report bugs and workarounds
Post Reply
zane93
Posts: 45
Joined: 08 Mar 2016 22:08

updating host name - SQL syntax Error

Post 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;"
User avatar
shawniverson
Posts: 3783
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: updating host name - SQL syntax Error

Post by shawniverson »

Checking...
User avatar
shawniverson
Posts: 3783
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: updating host name - SQL syntax Error

Post by shawniverson »

Confirmed.
zane93
Posts: 45
Joined: 08 Mar 2016 22:08

Re: updating host name - SQL syntax Error

Post by zane93 »

Thanks for the fix!
Post Reply