Solutions

How to solve Invalid default value for ‘created_at’ while adding new column in database.

[Problem:]
While adding new column to the table by alter method, I used this sql code

 

ALTER TABLE investments ADD bank TEXT;
ERROR 1067 (42000): Invalid default value for ‘created_at’

 

But An eeror came thought I tried various data type
ERROR 1067 (42000): Invalid default value for ‘created_at’

 

[solution]
The problem in my database is current mode is in the sql_mode

 

SO, in the sql I typed and hit the commend
set global sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';

 

 

and it solved the problem.
jaminrai

Recent Posts

The Duck and the Tortoise: A Tale of Patience and Teamwork

In a serene forest by the edge of a sparkling lake, there lived a cheerful…

5 days ago

10 Smart Strategies for a Secure and Enjoyable Retirement

Retiring comfortably is a goal many aspire to achieve, and with the right strategies, it’s…

1 week ago

Troubleshooting a Slow Computer

Is your computer running frustratingly slow? Don't worry; you're not alone in facing this common…

1 week ago

The Clever Fox and the Greedy Crow

Once, in a sunny forest, Fox and Crow were friends. One day, Crow found a…

1 week ago

The Little Lantern and the Lost Stars

Once upon a time, in a cozy village nestled between rolling hills and whispering forests,…

1 week ago

The Lantern in the Storm

In a small village nestled between rolling hills and a winding river, there lived a…

1 week ago