首页 文章

Mysql UNIQUE KEY约束 - a和å被视为相同的字符

提问于
浏览
4

我在列上有一个唯一的键 . 当我插入 a 然后 å 时,它会抛出一个错误:

PHP致命错误:未捕获异常'PDOException',消息'SQLSTATE [23000]:完整性约束违规:1062重复条目'å'表示密钥'constraint-1''..

....但 aå 是不同的UTF字符 - 所以发生了什么......?

表有 DEFAULT CHARSET=utf8mb4utf8mb4_unicode_ci 整理 .

1 回答

  • -4

    在唯一列上使用collation latin1_swedish_ci .

    This is my server screen

    Screen after selecting database

    Screen after selecting table

    Records in the table

    Error while entering duplicate value

相关问题