Last active
February 18, 2022 08:44
-
-
Save TomCan/7bd92f4a58bf5b74f469531715b20768 to your computer and use it in GitHub Desktop.
Fixing unusable table due to "ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes."
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you find yourself locked in a situation where you can't do anything on a table (not even select) when getting | |
```ERROR 1709 (HY000): Index column size too large. The maximum column size is 767 bytes.``` | |
then this on is for you. | |
Cause: Your key field is utf8mb4, which uses 4 bytes per character, and row_format isn't set to Dymanic. | |
Problem: you can't do anything with the table data (SELECT, UPDATE, DELETE,ALTER,DROP,... | |
Solution: | |
- stop mysqld and start mysqld in debug mode through (/usr/bin/mysqld-debug) | |
- connect to mysql, and set debugging options: | |
```SET SESSION debug='+d,skip_dd_table_access_check';``` | |
- find the ID of the offending table: | |
```SELECT t.id,t.row_format FROM mysql.tables t INNER JOIN mysql.schemata s ON t.schema_id=s.id WHERE s.name ='your-database' AND t.name='your-table';``` | |
- Change the row format of that table to dynamic. | |
```UPDATE mysql.tables SET row_format="Dynamic" WHERE id = 'id-of-table-you-just-found';``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment