我一直在阅读有关此错误的信息,但找不到如何修复此错误。
我在这句话中每小时都有一个时间表:
UPDATE radacct SET
radacct.AcctStopTime=NOW(),
radacct.AcctTerminateCause='Stale-Session'
WHERE ((UNIX_TIMESTAMP(NOW()) - (UNIX_TIMESTAMP(radacct.acctstarttime) + radacct.acctsessiontime)) > (60*6+60*6))
AND (AcctStopTime = '0000-00-00 00:00:00' OR AcctStopTime IS NULL)
有时我会遇到这个错误:
BIGINT UNSIGNED value is out of range in '(unix_timestamp(now()) - (unix_timestamp(`radius`.`radacct`.`acctstarttime`) + `radius`.`radacct`.`acctsessiontime`))'
这是创建表:
CREATE TABLE `radacct` (
`radacctid` bigint(21) NOT NULL AUTO_INCREMENT,
`acctsessionid` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`acctuniqueid` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`username` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`groupname` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`realm` varchar(64) COLLATE utf8_unicode_ci DEFAULT '',
`nasipaddress` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`nasportid` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL,
`nasporttype` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`acctstarttime` datetime DEFAULT NULL,
`acctupdatetime` datetime DEFAULT NULL,
`acctstoptime` datetime DEFAULT NULL,
`acctinterval` int(12) DEFAULT NULL,
`acctsessiontime` int(12) unsigned DEFAULT NULL,
`acctauthentic` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`connectinfo_start` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`connectinfo_stop` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`acctinputoctets` bigint(20) DEFAULT NULL,
`acctoutputoctets` bigint(20) DEFAULT NULL,
`calledstationid` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`callingstationid` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`acctterminatecause` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`servicetype` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`framedprotocol` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
`framedipaddress` varchar(15) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`radacctid`),
UNIQUE KEY `acctuniqueid` (`acctuniqueid`),
KEY `username` (`username`),
KEY `framedipaddress` (`framedipaddress`),
KEY `acctsessionid` (`acctsessionid`),
KEY `acctsessiontime` (`acctsessiontime`),
KEY `acctstarttime` (`acctstarttime`),
KEY `acctinterval` (`acctinterval`),
KEY `acctstoptime` (`acctstoptime`),
KEY `nasipaddress` (`nasipaddress`),
KEY `callingstationid` (`callingstationid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=14270573 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
显示变量,如“sql_mode”
“sql_mode”,“NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
添加2:
这是最后一个按建议完美运行的查询@Rick James
UPDATE radacct SET
radacct.AcctStopTime=NOW(),
radacct.AcctTerminateCause='Stale-Session'
WHERE ( NOW() - interval (60*6+60*6) second > radacct.acctstarttime + interval radacct.acctsessiontime second )
AND (AcctStopTime = '0000-00-00 00:00:00' OR AcctStopTime IS NULL)
谢谢