-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Failed to initialize OAuth2 support: Error 1071: Specified key was too long; max key length is 767 bytes #3859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
utf8mb4 is not supported currently |
Which of these should I change to support gitea? (They are all at their default)
|
Tracked the issue down to this line which defines a indexed |
Found a workaround from #3516 (comment):
In summary, mariadb < 10.2 and mysql < 5.7 don't support longer indexed colums by default. above setting apply the settings that are default on newer versions. I realize that upgrading mariadb would be the proper solution, but the Arch package still seems to be stuck on 10.1 and I don't want to compile it myself. |
Found another workaround, create the table manually with an adjusted primary index length. CREATE TABLE `oauth2_session` (
`id` varchar(400) NOT NULL,
`data` text,
`created_unix` bigint(20) DEFAULT NULL,
`updated_unix` bigint(20) DEFAULT NULL,
`expires_unix` bigint(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `oauth2_session`
ADD PRIMARY KEY (`id`(191));
COMMIT; |
@drsect0r you don't need the second query. The first one will be fine, the problem is the fact that our mariadb installs use utf8mb4 as the default charset - and in this case it leads to problem. The solution is simply to create the table with utf8 instead of utf8mb4 - so the first query will suffice. This issue will probably create problems for other users who want to upgrade and have this kind of setup. I've created lafriks/xormstore#5 for this reason. |
Wouldn't that still be longer than that 767 bytes limit of old InnoDB? |
Yes, it looks like I didn't add the primary key in the end 🤦♂️ You are indeed right - the maximum you can go with the 767 bytes and utf8 limit is 255 characters. |
[x]
):Description
After updating to today's master, I got the mentioned error related to commit 5a62eb3. Database is MariaDB 10.1.32 with default character set utf8mb4. Reverting the commit fixes the error.
CC: @lafriks.
The text was updated successfully, but these errors were encountered: