mysql 版本 8.0.25
在 apache 日志中出现此错误:
错误查询:SQLSTATE[HY000]:一般错误:1267 非法混合排序规则 (utf8mb4_unicode_ci,IMPLICIT) 和 (utf8_general_ci,COERCIBLE) for operation '=' In query: SELECT
idaction
,type
,name
FROM matomo_log_action WHERE ( hash = CRC32(?) AND name = ? 和类型 = ? ) [...]
这是表的信息:
mysql> SHOW FULL COLUMNS FROM matomo_log_action;
+------------+------------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
| Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment |
+------------+------------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
| idaction | int unsigned | NULL | NO | PRI | NULL | auto_increment | select,insert,update,references | |
| name | varchar(4096) | utf8mb4_unicode_ci | YES | | NULL | | select,insert,update,references | |
| hash | int unsigned | NULL | NO | | NULL | | select,insert,update,references | |
| type | tinyint unsigned | NULL | YES | MUL | NULL | | select,insert,update,references | |
| url_prefix | tinyint | NULL | YES | | NULL | | select,insert,update,references | |
+------------+------------------+--------------------+------+-----+---------+----------------+---------------------------------+---------+
现在我想我需要将Collation
of 字段修改type
为utf8mb4_unicode_ci
,但不知道如何:
mysql> ALTER TABLE matomo_log_action MODIFY type tinyint unsigned CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
ERROR 1064 (42000): 你的 SQL 语法有错误;检查与您的 MySQL 服务器版本对应的手册,了解在第 1 行的“CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci”附近使用的正确语法