I found this expression on the Internet, which was implemented on MySQL (version 5.7) with local wamp.
alter table account.users add column reg_time datetime not null default now();
But I'm on the server side, with the same SQL statement
alter table users add column reg_time datetime not null default now();
But hint: Invalid default value for ' Reg_time '
Server MySQL version is 5.0
What should I do?
Reply content:
I found this expression on the Internet, which was implemented on MySQL (version 5.7) with local wamp.
alter table account.users add column reg_time datetime not null default now();
But I'm on the server side, with the same SQL statement
alter table users add column reg_time datetime not null default now();
But hint: Invalid default value for ' Reg_time '
Server MySQL version is 5.0
What should I do?
ALTER TABLE `users`ADD COLUMN `reg_time` timestamp NOT NULL ON UPDATE CURRENT_TIMESTAMP
SQL Server uses GETDATE ()
MySQL should correspond to now ()
Timestamp timestamp Type field has automatic update of insert time and modified time two properties