[Err] 1071 - Specified key was too long; max key length is 1000 bytes
时间: 2023-10-13 13:03:51 浏览: 134
MySQL错误“Specified key was too long; max key length is 1000 bytes”的解决办法
1071 - Specified key was too long; max key length is 1000 bytes 是一个错误信息,表示指定的键太长,最大键长度为1000个字节。这个错误通常发生在数据库中创建唯一键时,当键的长度超过了数据库所允许的最大长度时会出现该错误。引用提到了这个错误信息,并且指出是在尝试为`users`表添加一个唯一键(`users_username_unique`)时出现的。MySQL 5.7版本中,varchar的长度是根据字符数来计算的,一个字母或汉字都算作一个字符。因此,当键的长度超过1000个字节时,就会出现这个错误。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [[Err] 1071 - Specified key was too long; max key length is 767 bytes](https://blog.csdn.net/woshiwozzl/article/details/107491729)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [创建索引时,解决1071 Specified key was too long; max key length is 1000 bytes错误信息](https://blog.csdn.net/alpeace/article/details/116353774)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文