[Skip to main content](#vessel-content)

#   Error on changing encoding of hikashop\_product table

##

- **[yanliom](/forum/user/45218-yanliom "View yanliom's Profile")**
- [![yanliom's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/45218-yanliom "View yanliom's Profile") Topic Author
- [ Offline](/forum/user/45218-yanliom)

Less More

- Posts: 66
- Thank you received: 1
-
-

4 years 6 months ago [\#340953](#340953) by [yanliom](/forum/user/45218-yanliom "View yanliom's Profile")  *[Error on changing encoding of hikashop\_product table](/forum/32-content-creation/904277-error-on-changing-encoding-of-hikashop-product-table#340953 "-- HikaShop version -- : 4.5.0 -- Joomla version -- : 3.10.8  Hello,  I'm trying to convert the encoding of hikashop&#95;product table to utf8mb4 support emoticons through phpMyAdmin but I get the following error: ALTER TABLE &#96;seemy&#95;hikashop&#95;product&#96; CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4&#95;general&#95;ci #1071 - Specified key was too long; max key length is 1000 bytes  What steps should I take to proceed with the conversion?  Thank you, Yannis")* was created by *[yanliom](/forum/user/45218-yanliom "View yanliom's Profile")*

-- HikaShop version -- : 4.5.0
-- Joomla version -- : 3.10.8

Hello,

I'm trying to convert the encoding of hikashop_product table to utf8mb4 support emoticons through phpMyAdmin but I get the following error:
ALTER TABLE &#96;seemy_hikashop_product&#96; CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci
\#1071 - Specified key was too long; max key length is 1000 bytes

What steps should I take to proceed with the conversion?

Thank you,
Yannis

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vOTA0Mjc3LWVycm9yLW9uLWNoYW5naW5nLWVuY29kaW5nLW9mLWhpa2FzaG9wLXByb2R1Y3QtdGFibGU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86359
- Thank you received: 14296
-
-

4 years 6 months ago [\#340956](#340956) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Error on changing encoding of hikashop\_product table](/forum/32-content-creation/904277-error-on-changing-encoding-of-hikashop-product-table#340956 "-- HikaShop version -- : 4.5.0 -- Joomla version -- : 3.10.8  Hello,  I'm trying to convert the encoding of hikashop&#95;product table to utf8mb4 support emoticons through phpMyAdmin but I get the following error: ALTER TABLE &#96;seemy&#95;hikashop&#95;product&#96; CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4&#95;general&#95;ci #1071 - Specified key was too long; max key length is 1000 bytes  What steps should I take to proceed with the conversion?  Thank you, Yannis")*

Hi,

In your hikashop_product table, you have several indexes and a unique key.
By default these are:
UNIQUE KEY &#96;product_code&#96; (&#96;product_code&#96;),
KEY &#96;product_parent_id&#96; (&#96;product_parent_id&#96;),
KEY &#96;product_main_index&#96; (&#96;product_type&#96;,&#96;product_quantity&#96;,&#96;product_published&#96;)
These indexes allow MySQL to more rapidely find elements in the hikashop_product table, especially when there are hundreds of thousands or millions of entries.
As you can see, these indexes are made on specific columns of the hikashop_product column.
Out of these, 2 are varchar(255) columns: product_type and product_code
So that means that each one can have up to 255 characters.
With the default UTF8 collation on these, they go up to 3 byes per character, so they never go over the 1000 bytes threshold.
If you want to convert these columns to use utf8mb4 it means that the maximum size of a text in these columns would be 4*255 (since utf8mb4 means that the characters are encoded with 4 bytes) which equals to 1020.
However, this means that the indexes based on these columns would exceed the 1000 bytes key length limit of your MySQL and that's why you get that error message.
To avoid that, you should edit these indexes and add a limit on the number of characters to index. For the product_type column, 20 characters will be enough. And for the product_code column, it depends on the length of your product codes but I doubt you would have codes bigger than 100 characters on a normal shop.
So before changing to utf8mb4, you need first to reduce the size of the indexes on these two columns:
[ stackoverflow.com/questions/50345159/wha...-index-in-phpmyadmin](https://stackoverflow.com/questions/50345159/what-does-size-do-when-adding-index-in-phpmyadmin)

More information on that issue is available here:
[ stackoverflow.com/questions/8746207/1071...length-is-1000-bytes](https://stackoverflow.com/questions/8746207/1071-specified-key-was-too-long-max-key-length-is-1000-bytes)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMyLWNvbnRlbnQtY3JlYXRpb24vOTA0Mjc3LWVycm9yLW9uLWNoYW5naW5nLWVuY29kaW5nLW9mLWhpa2FzaG9wLXByb2R1Y3QtdGFibGU/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.041 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
