ERROR 1067 (42000): Invalid default value for 'created_at'

前端 未结 14 1725
-上瘾入骨i
-上瘾入骨i 2020-12-04 07:31

When I tried to alter the table it showed the error:

ERROR 1067 (42000): Invalid default value for \'created_at\'

I googled for this error

14条回答
  •  醉话见心
    2020-12-04 08:13

    As mentioned in @Bernd Buffen's answer. This is issue with MariaDB 5.5, I simple upgrade MariaDB 5.5 to MariaDB 10.1 and issue resolved.

    Here Steps to upgrade MariaDB 5.5 into MariaDB 10.1 at CentOS 7 (64-Bit)

    1. Add following lines to MariaDB repo.

      nano /etc/yum.repos.d/mariadb.repo and paste the following lines.

    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.1/centos7-amd64
    gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck=1

    1. Stop MariaDB, if already running service mariadb stop
    2. Perform update

      yum update

    3. Starting MariaDB & Performing Upgrade

      service mariadb start

      mysql_upgrade

    Everything Done.

    Check MariaDB version: mysql -V


    NOTE: Please always take backup of Database(s) before performing upgrades. Data can be lost if upgrade failed or something went wrong.

提交回复
热议问题