Error while assigning default value to a datetime field in mysql

HI,
I am getting the following error on creation of a column with type datetime and setting the default value to NOW().
Basicaly i want to create a column in my table so that whenever a new row is inserted it automatically gets populated with the current date and time.
An error occurred when trying to change the field 'created_on' via

ALTER TABLE `retentions` CHANGE `created_on` `created_on` DATETIME
 NULL
 DEFAULT 'NOW()'

MySQL said: Invalid default value for 'created_on'

Open in new window

Whats wrong with this... how can i achieve this..

Thanks
Rohit BajajAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
Here is an explanation/setup that will get you to where you want to be.
http://m.alvinalexander.com/mysql/mysql-default-date-now-current-date-time

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
Arnold is right.  In the table definition you can use CURRENT_TIMESTAMP.  In the SQL query you can use NOW().
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.