MySQL ON UPDATE CURRENT_TIMESTAMP not updating

前端 未结 5 1812
轮回少年
轮回少年 2020-12-24 13:06

I\'ve got a table that looks like this:

CREATE TABLE IF NOT EXISTS `Hosts` (
`id` int(128) NOT NULL AUTO_INCREMENT,
`IP` varchar(15) NOT NULL DEFAULT \'\',
`         


        
5条回答
  •  Happy的楠姐
    2020-12-24 13:34

    You must remember that if no value was changed on update it won't set the current time stamp,

    You have to set the value in query NOW() to set for the current time stamp !!!

    update Hosts set Backupstatus = 'FAIL',Lastconnection = NOW() , Backupmsg = 'Connection timed out' where Tid = 'SITE001'

    Remember the value must change in order for the current time stamp to change.

提交回复
热议问题