Our server is creating a lot of tables and one of them is the Lock_ table.
We are using MySQL 5.5 on Percona. Also we are using utf8_general_ci and utf8.
It throws the following error when creating the following index on Lock_ table:
ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes Here is the create-table query:
create table Lock_ ( uuid_ VARCHAR(75) null, lockId LONG not null primary key, companyId LONG, userId LONG, userName VARCHAR(75) null, createDate DATE null, className VARCHAR(75) null, key_ VARCHAR(200) null, owner VARCHAR(255) null, inheritable BOOLEAN, expirationDate DATE null ); Index query:
create unique index IX_DD635956 on Lock_ (className, key_, owner); This problem is happening on one of our prod servers (previously it was standalone mysql and then later moved to percona, but the problem was present in both the editions), but this is working fine on our dev environment.
So is there a way we can update the prod environment's index length or something so that it does not throw this error?
Thanks
create unique index IX_DD635956 ...statement throws the error and not something else?SHOW CREATE TABLE Lock_ ;output in the question.) Also add the specific version (mysql or percona) that gives you this error.ALTER TABLE ENGINE=MyISAMand there you have the error. Oh, I've seen the error message, I am wrong.'utf8mb4'. I don't have Percona to test right now but they are either not showing the code that produces the error or something is fishy is going on.