MySQL error: The maximum column size is 767 bytes

前端 未结 10 1789
陌清茗
陌清茗 2020-12-24 15:41

When I run a program which does something with MySQL, I got this error message:

2015-06-10 15:41:12,250 ERROR app.wsutils 419 INCRON: Error: (\'HY000\

10条回答
  •  悲哀的现实
    2020-12-24 16:13

    In my case (MySQL version 5.6) the issue was that I was trying to create a table with a column that can have up to 256 characters (the db uses utf8 collation), so 3 bytes per 1 utf8 character = 256*3=768 bytes. The fix was to simply have 255 characters instead of 256.

    I could also set innodb_large_prefix, like others suggest, but in my case it was easier to just have fewer symbols.

提交回复
热议问题