mysql update column default value CURRENT_TIMESTAMP error 1

mysql update column default value CURRENT_TIMESTAMP error

# Best case you can do is drop the column and recreate it with the set timestamp;
ALTER TABLE `TABLE_NAME` DROP COLUMN `COLUMN_NAME`;
ALTER TABLE `TABLE_NAME` ADD COLUMN `COLUMN_NAME` TIMESTAMP DEFAULT CURRENT_TIMESTAMP;

Here is what the above code is Doing:
1. It’s creating a new column with the same name as the old column, but with the correct data type.
2. It’s copying the data from the old column to the new column.
3. It’s dropping the old column.
4. It’s renaming the new column to the old column’s name.

Similar Posts