1071 - Specified key was too long; max key length is 767 bytes
时间: 2023-10-19 20:26:03 浏览: 97
Laravel 5.4中migrate报错: Specified key was too long error的解决
1071 - Specified key was too long; max key length is 767 bytes错误是指在创建索引时,索引字段的长度超过了数据库限制的最大长度767字节。这个错误可能会出现在不同的数据库系统中,比如MySQL。这个错误通常出现在创建唯一索引时,因为唯一索引需要保证索引字段的唯一性。如果你的索引字段过长,超过了数据库限制的最大长度,就会出现这个错误。解决这个问题的方法有几种。一种是缩短索引字段的长度,使其不超过最大长度限制。另一种是修改数据库的配置,增加最大索引长度的限制。还有一种是考虑使用前缀索引,将索引字段的前几个字符作为索引,以减少索引字段的长度。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [1071 - Specified key was too long; max key length is 767 bytes](https://blog.csdn.net/qq_38925911/article/details/118210392)[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: 33.333333333333336%"]
- *2* [MySQL错误“Specified key was too long; max key length is 1000 bytes”的解决办法](https://download.csdn.net/download/weixin_38606300/12835900)[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: 33.333333333333336%"]
- *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: 33.333333333333336%"]
[ .reference_list ]
阅读全文