Change tinyint default value into 1 mysql

Karuppiah RK picture Karuppiah RK · Apr 4, 2014 · Viewed 38.2k times · Source

I have a status column in my database table. Type : tinyint(4) and the Default value is 0. I want to change the default value to 1. How to do that? May be this is a very simple question, but I don't know.

Answer

M Khalid Junaid picture M Khalid Junaid · Apr 4, 2014

You can do so

ALTER TABLE `table_name` CHANGE `column_name` `column_name` TINYINT(4) DEFAULT 1 NOT NULL;