Invalid default value for 'dateAdded'

前端 未结 8 1022
野性不改
野性不改 2020-11-27 15:17

I got a stupid problem with SQL that I can\'t fix.

ALTER TABLE  `news` 
 ADD  `dateAdded` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP AUTO_INCREMENT ,
 ADD PRIMARY         


        
8条回答
  •  暖寄归人
    2020-11-27 15:37

    Change the type from datetime to timestamp and it will work! I had the same issue for mysql 5.5.56-MariaDB - MariaDB Server Hope it can help... sorry if depricated

提交回复
热议问题