Encountered the above-mentioned bug in production today:
When the system variable innodb_large_prefix is enabled, for InnoDB tables that use DYNAMIC or COMPRESSED row format, the index key prefix is limited to 3072 bytes. If innodb_large_prefix is disabled, no matter what table it is, the index key prefix is limited to 767 bytes.
The above bug is obviously that the index exceeds the limited length of 767 (innodb_large_prefix is disabled in our production):
I found that the table where the error was reported has established a varchar type index, varchar(255). I think there is no problem. In fact, it is not. The above 767 is a byte, and the varchar type is a character. At the same time, I found that the character set I used is ( utf8mb4), this means that the maximum number of bytes per character is 4, so it is obvious that 4*255> 767
So the above error was reported (Specified key was too long; max key length is 767 bytes).
Change the number of characters in varchar, I changed it to 64. varchar(64)
Or enable innodb_large_prefix, then the limit value will increase to 3072
- How to Solve the Primary Key of mybatisPlus Inserted Data is too Large Issue
- IDEA Error: Command line is too long [How to Solve]
- Error running ‘Application‘: Command line is too long [How to Solve]
- Using mybatis statement.getGenreatedKeys(); usegeneratedkeys = “true”; using self incrementing primary key to get primary key value policy and Oracle do not support self incrementing, Oracle uses sequence
- How to Solve IDEA Error: Command line is too long
- Public Key Retrieval is not allowed [How to Solve]
- [Solved] IDEA Error: Error running ‘Application‘: Command line is too long
- [Solved] Command line is too long. Shorten command line for XXXXXXXTest.rmLogRecordOver Error running
- Project Startup Error: Error running ‘xxxApplication‘；Command line is too long, Shoerten command line for……..
- Idea error: (44,22) Java: constant string too long
- [Solved] Error running ‘ServiceStarter’: Command line is too long. Shorten command line for ServiceStarter or also for Application default configuration
- [Solved] IDEA Start Project Error: Error running ‘xxxxxx‘: Command line is too long. Shorten command line for …..
- [Solved] error running ‘xx‘ Command line is too long shorten command line for xx or also for Spring Boot defa
- [Solved] stream Convert list to map Error: java.lang.IllegalStateException: Duplicate key
- Mybatis sets the primary key Auto-Increment error: No setter found for the keyProperty
- [Solved] Error getting generated key or setting result to parameter object. UnsupportedOperationException
- [Solved] JPA Create Sheet error at the First time: Cant DROP [xxx]；check that column/key exists
- [Solved] Internal error (java.lang.IllegalStateException): Duplicate key org.jetbrains
- The @value annotation of springboot adds the default value to solve the startup error caused by the non-existent key
- [Solved] Springboot Deploy Error: Input length = 1 or Input length = 2