MySQL Change a column ENUM value

If I understand your question, you want to rename the existing enum value NEWS to FEATURED_COVERAGE. If so, you need to follow below steps,

  1. Alter the table and add the new enum value to the column, so that you will have 3 enums

    ALTER TABLE `content` CHANGE `pagetype` `pagetype`
    ENUM('FEATURED_COVERAGE','PRESS_RELEASE', 'NEWS') CHARACTER SET utf8
    COLLATE utf8_general_ci NOT NULL;
    
  2. Set the old enum value to new value for all records.

    UPDATE `content` set `pagetype` = 'FEATURED_COVERAGE' where
    `pagetype` = 'NEWS';
    
  3. Alter the table and drop the old enum value.

    ALTER TABLE `content` CHANGE `pagetype` `pagetype`
    ENUM('FEATURED_COVERAGE','PRESS_RELEASE') CHARACTER SET utf8 COLLATE
    utf8_general_ci NOT NULL;
    

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)