# Slave mysql error when running alter statement on master

**URL:** <https://forums.percona.com/t/slave-mysql-error-when-running-alter-statement-on-master/38177>\
**Category:** MySQL & MariaDB\
**Created:** [June 2, 2025, 2:20am UTC](https://forums.percona.com/t/slave-mysql-error-when-running-alter-statement-on-master/38177 "2025-06-02T02:20:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tai\_Nguyen\_Huu](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tai_nguyen_huu/32/19395_2.png) [@Tai\_Nguyen\_Huu](https://forums.percona.com/u/Tai_Nguyen_Huu)\
**Post date:** [June 2, 2025, 2:20am UTC](https://forums.percona.com/t/slave-mysql-error-when-running-alter-statement-on-master/38177/1 "2025-06-02T02:20:34Z")

</div>

Hi everyone,  
I have master slave model on mysql, I run alter statement on master. The alter statement works on master but slave gives error that it cannot convert data from enum to long. I don’t know why there is that error. Below is the schema of the table and my alter statement.

schema table:

```auto
CREATE TABLE `async_add_partition` (
  `impala_tbl_name` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL,
  `partition_value` varchar(250) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'data_date_key = 20230206, action_hour = 19',
  `partition_key` varchar(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'data_date_key, action_hour',
  `status` enum('NEW','DONE','REJECT','TABLE_NOT_FOUND') COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NEW',
  `error_log` longtext COLLATE utf8mb4_unicode_ci COMMENT 'error log query',
  `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`impala_tbl_name`,`partition_value`),
  KEY `status` (`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

```

alter statement

```auto
ALTER TABLE bigdata.async_add_partition ADD trino_status ENUM('NEW','DONE','REJECT') CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT 'NEW' NOT NULL COMMENT 'Trang thai cache cua trino' AFTER `status`;

```

show slave status

```auto
Column 4 of table 'bigdata.async_add_partition' cannot be converted from type 'enum' to type 'longtext' 

```

---

<div class="post-metadata">

**Author:** ![anil.joshi](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/anil.joshi/32/13100_2.png) [@anil.joshi](https://forums.percona.com/u/anil.joshi)\
**Post date:** [June 2, 2025, 9:16am UTC](https://forums.percona.com/t/slave-mysql-error-when-running-alter-statement-on-master/38177/2 "2025-06-02T09:16:46Z")

</div>

@Tai_Nguyen_Huu

Did you checked if there is not any mismatch in the table schema of both source and replica ? What exact database version you having for both ?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [June 2, 2025, 9:47pm UTC](https://forums.percona.com/t/slave-mysql-error-when-running-alter-statement-on-master/38177/3 "2025-06-02T21:47:59Z")

</div>

Run `SHOW CREATE TABLE async_add_partition` on both source, and replica. Verify schema matches _before_ making any table alter.

Also, string-based PRIMARY KEYs are non-performant. You would do better to have an AUTO\_INCREMENT INT primary key, and a `UNIQUE(impala_tbl_name, partition_value)` index on those columns.

---

<div class="post-metadata">

**Author:** ![Tai\_Nguyen\_Huu](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/tai_nguyen_huu/32/19395_2.png) [@Tai\_Nguyen\_Huu](https://forums.percona.com/u/Tai_Nguyen_Huu)\
**Post date:** [June 3, 2025, 9:05am UTC](https://forums.percona.com/t/slave-mysql-error-when-running-alter-statement-on-master/38177/4 "2025-06-03T09:05:20Z")

</div>

this is schema of table on slave

```auto
CREATE TABLE bigdata.async_add_partition (
    impala_tbl_name VARCHAR(250) COLLATE utf8mb4_unicode_ci NOT NULL,
    partition_value VARCHAR(250) COLLATE utf8mb4_unicode_ci NOT NULL 
                     COMMENT 'data_date_key = 20230206, action_hour = 19',
    partition_key VARCHAR(250) COLLATE utf8mb4_unicode_ci DEFAULT NULL 
                     COMMENT 'data_date_key, action_hour',
    status ENUM('NEW','DONE','REJECT','TABLE_NOT_FOUND') 
                     COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'NEW',
    error_log LONGTEXT COLLATE utf8mb4_unicode_ci 
                     COMMENT 'error log query',
    created DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    modified DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP 
                     ON UPDATE CURRENT_TIMESTAMP,
    
    PRIMARY KEY (impala_tbl_name, partition_value),
    KEY status (status)
) 
ENGINE=InnoDB 
DEFAULT CHARSET=utf8mb4 
COLLATE=utf8mb4_unicode_ci;

```

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [June 3, 2025, 1:08pm UTC](https://forums.percona.com/t/slave-mysql-error-when-running-alter-statement-on-master/38177/5 "2025-06-03T13:08:43Z")

</div>

Can you add the column to the end of the table? (eg: remove the “AFTER”) Does this replicate?
