'Missing comma before start of a new alter operation. (near "CHARACTER SET")

Mysql - phpmyadmin

What's wrong with this query?

ALTER TABLE `invoices` 
CHANGE `status` `status` ENUM('paid','due','canceled','partial','cheque') 
CHARACTER SET `utf8` COLLATE `utf8_general_ci` NOT NULL DEFAULT `due`;

I am getting this error:

Missing comma before start of a new alter operation. (near "CHARACTER SET") and not able to run this query on live server. Query was generated when I changed the table structure on my localhost during development.

I also tried below query mentioned in many threads but it also give same above error:

ALTER TABLE `invoices` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;



Solution 1:[1]

Am not sure why. I also faced the same issue.

Though it appears like:

When removed both CHARACTER and COLLATE part from SQL, parser works fine.

i.e

Before

ALTER TABLE `place` CHANGE COLUMN `plc_location_type` `gplc_location_type` ENUM('LOCATION') CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci' NOT NULL;

After

ALTER TABLE `place` CHANGE COLUMN `plc_location_type` `gplc_location_type` ENUM('LOCATION') NOT NULL;

REFERENCE:
https://github.com/phpmyadmin/sql-parser/issues/229

Good luck!

Solution 2:[2]

ALTER TABLE table_name 
CHANGE old_column_name1 new_col_name1 Data Type,
CHANGE old_column_name2 new_col_name2 Data Type,
CHANGE old_column_name3 new_col_name3 Data Type;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 steven7mwesigwa
Solution 2 Obsidian