MySQL error: “Column 'columnname' cannot be part of FULLTEXT index”

前端 未结 3 1077
攒了一身酷
攒了一身酷 2021-02-07 15:59

Recently I changed a bunch of columns to utf8_general_ci (the default UTF-8 collation) but when attempting to change a particular column, I received the MySQL error:

<         


        
3条回答
  •  时光说笑
    2021-02-07 16:38

    For DBeaver/database tool users.

    When you use interface to modify more than one column, the tool generate commands like this :

    ALTER TABLE databaseName.tableName MODIFY COLUMN columnName1 text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL;
    ALTER TABLE databaseName.tableName MODIFY COLUMN columnName2 varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL;
    

    This is not working because you must modify the charsets at the same time.

    So, you have to change it manually, in one command :

    ALTER TABLE databaseName.tableName 
    MODIFY COLUMN columnName1 text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
    MODIFY COLUMN columnName2 text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL;
    

    utf8 or utf8mb4 ? See here.

提交回复
热议问题