Specified key was too long; max key length is 1000 bytes Hatası

Started by kmy, May 26, 2018, 02:23:47 PM

Previous topic - Next topic

kmy

Merhaba. Daha önce defalarca kurup kaldırdığım Pretty URLs kurmaya çalıştığımda aşağıdaki uyarıyı alıyorum.
Specified key was too long; max key length is 1000 bytes
Dosya: /home/k../public_html/forum/Packages/temp/SMF2-0/install.php
Satır: 39

Bu konunun çözümü için ne yapabilirim?

s10dulkar


shawnb61

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

vbgamer45

Quote from: shawnb61 on December 16, 2020, 11:17:54 AM
Install with the utf8 option.
Can you explain this a little? I was wondering if I should change something. I also don't see the option to set an index size length though the SMF system.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

shawnb61

(I apologize in advance for not posting in Turkish on the Turkish board!  I'm sure I'm violating a rule somewhere... :o)

Recent versions of mysql are defaulting their collations to utf8mb4.  The problem is that SMF 2.0, if utf8 is not selected, uses the database/server default.  Potentially 4 bytes per character.  We have a couple varchar(255) fields that are indexed.  That means those indexes may be 4x255=1020 bytes each.  The index max is sometimes 767 (older innodb) or 1000 (myisam).

SMF 2.0 does not support mb4 properly.  Specifying UTF8 limits you to 3 bytes per character and avoids the index length - and other - mb4 issues.  In 2.0.18+, we are defaulting to utf8.

More on index prefixes here:
https://dev.mysql.com/doc/refman/8.0/en/column-indexes.html
https://dev.mysql.com/doc/refman/8.0/en/innodb-limits.html#:~:text=The%20index%20key%20prefix%20length%20limit%20is%20767%20bytes%20for,4%20bytes%20for%20each%20character.

mb4 support history:
https://mysqlserverteam.com/mysql-8-0-when-to-use-utf8mb3-over-utf8mb4/
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

shawnb61

So...  My guidance to the OP would be:
- If your SMF forum is not UTF8, convert to UTF8
- Set the database's default collation to utf8_general_ci - so new tables are also created utf8
- Install the mod

I suspect the new tables created when the mod is installed are using the database default which is mb4.
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

vbgamer45

Bah, damn more support issues. Stuff I need to be aware of.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: