Skip to content

MySql /Mariadb error: max key length is 767 byte #4894

Closed
@ulorentz

Description

@ulorentz
  • Gogs version (or commit ref): 0.11.34
  • Git version: 2.11.0
  • Operating system: Debian 9
  • Database (use [x]):
    • PostgreSQL
      MySQL
      MSSQL
      SQLite
  • Can you reproduce the bug at https://try.gogs.io:
    • Yes (provide example URL)
      No
      Not relevant
  • Log gist (usually found in log/gogs.log):

Description

I tried to install from binary, I created the database on MariaDB, I launched ./gogs web and opened the installing page on browser. I inserted all needed but I received the error "Database setting is not correct: Error 1709: Index column size too large. The maximum column size is 767 bytes."
I think it's a problem related to MariaDB char set size, but I wasn't able to solve it.
...

Activity

playmyskay

playmyskay commented on Nov 26, 2017

@playmyskay

I have the same error.
It seems to be a similar problem which is also described here:
https://discuss.gogs.io/t/solved-mysql-error-1064-while-running-first-install/1604/3

I tried these options in mysql (mariadb):
SET GLOBAL innodb_file_format=Barracuda;
SET GLOBAL innodb_file_per_table=ON;
innodb_large_prefix=1

But the create statements of the tables should have (which is not the case):
ROW_FORMAT=DYNAMIC;

ulorentz

ulorentz commented on Nov 27, 2017

@ulorentz
Author

For me, it doesn't work. Do you confirm those commands don't solve the issue?

ImAnOwl

ImAnOwl commented on Nov 27, 2017

@ImAnOwl

have the same problem, but I have already read, upgrading mysql to 5.7 should solve the problem. I'll write later again, when i solved it

ulorentz

ulorentz commented on Nov 27, 2017

@ulorentz
Author

Debian 9 uses MariaDB 10.1, that should be mySQL compatible, but it's not mySQL.

ImAnOwl

ImAnOwl commented on Nov 27, 2017

@ImAnOwl

I upgraded to MariaDB 10.2 and now it works. :)

playmyskay

playmyskay commented on Nov 27, 2017

@playmyskay

Here a short description how i get it working.. it is very laborious but it works for me:

  1. Create your gogs database as usual
  2. Visit the install page
  3. Type in your data (database, user, etc.)
  4. Click on Button "Install"
    -> It will fail with: 'Error 1709: Index column size too large. The maximum column size is 767 bytes.'
    BUT the tables were partially created.

To see which tables are currently present:
use gogs; (gogs = your gogs database name!)
SHOW TABLE STATUS;

  1. Alter the tables with the following command:
    ALTER TABLE _tablename_ ROW_FORMAT=DYNAMIC;

  2. Now go back to step 2 and repeat it. Always alter all "new" tables which were created.

After 4 or 5 rounds you get every needed table and it's done.

I am not completely sure whether you have to set the above mentioned options. I have done that.

Good luck.

ulorentz

ulorentz commented on Nov 27, 2017

@ulorentz
Author

It works! Thank you very much.
It would be nice to have this process automatic (what should change in gogs code?).

intersel

intersel commented on Nov 27, 2017

@intersel

@playmyskay Thanks a lot for the solution that worked for me too on
mysql Ver 15.1 Distrib 10.0.32-MariaDB, for debian-linux-gnu (i686) using readline 5.2
on debian 8

m2nlight

m2nlight commented on Dec 4, 2017

@m2nlight
Contributor

Because of mysql 5.6 (includes prior versions) InnoDB max index length is 767 bytes, mysql 5.7.7 is up to 3072 bytes.
If some varchar column's length is 255, when the character format is utf-8 needs 255*3=765 bytes for index length, It's OK.
But, an utf8mb needs 255*4=1020 bytes for index length.

Solutions:

  • UPGRADE the mysql to 5.7.7(Mariadb 10.2.2)
  • Change the utf8mb column length to 191 (191*4=764)
  • Change the utf8mb to utf8
  • set innodb_file_format=Barracuda, innodb_large_prefix=on and create table using ROW_FORMAT=DYNAMIC or COMPRESSED (default for 5.7.7)

I will fix it later.

laurivosandi

laurivosandi commented on Dec 16, 2017

@laurivosandi

Hi, on Debian 9 with MariaDB this sill seems to be much of an hassle. Just to save someone else a bit time, dump this repeatedly to the SQL prompt until Gogs install finishes:

ALTER TABLE `access` ROW_FORMAT=DYNAMIC;
ALTER TABLE `access_token` ROW_FORMAT=DYNAMIC;
ALTER TABLE `action` ROW_FORMAT=DYNAMIC;
ALTER TABLE `attachment` ROW_FORMAT=DYNAMIC;
ALTER TABLE `collaboration` ROW_FORMAT=DYNAMIC;
ALTER TABLE `comment` ROW_FORMAT=DYNAMIC;
ALTER TABLE `deploy_key` ROW_FORMAT=DYNAMIC;
ALTER TABLE `follow` ROW_FORMAT=DYNAMIC;
ALTER TABLE `hook_task` ROW_FORMAT=DYNAMIC;
ALTER TABLE `issue` ROW_FORMAT=DYNAMIC;
ALTER TABLE `issue_label` ROW_FORMAT=DYNAMIC;
ALTER TABLE `issue_user` ROW_FORMAT=DYNAMIC;
ALTER TABLE `label` ROW_FORMAT=DYNAMIC;
ALTER TABLE `login_source` ROW_FORMAT=DYNAMIC;
ALTER TABLE `milestone` ROW_FORMAT=DYNAMIC;
ALTER TABLE `mirror` ROW_FORMAT=DYNAMIC;
ALTER TABLE `protect_branch` ROW_FORMAT=DYNAMIC;
ALTER TABLE `protect_branch_whitelist` ROW_FORMAT=DYNAMIC;
ALTER TABLE `public_key` ROW_FORMAT=DYNAMIC;
ALTER TABLE `pull_request` ROW_FORMAT=DYNAMIC;
ALTER TABLE `release` ROW_FORMAT=DYNAMIC;
ALTER TABLE `repository` ROW_FORMAT=DYNAMIC;
ALTER TABLE `star` ROW_FORMAT=DYNAMIC;
ALTER TABLE `two_factor` ROW_FORMAT=DYNAMIC;
ALTER TABLE `two_factor_recovery_code` ROW_FORMAT=DYNAMIC;
ALTER TABLE `upload` ROW_FORMAT=DYNAMIC;
ALTER TABLE `user` ROW_FORMAT=DYNAMIC;
ALTER TABLE `watch` ROW_FORMAT=DYNAMIC;
ALTER TABLE `webhook` ROW_FORMAT=DYNAMIC;

41 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @laurivosandi@gabriellima@intersel@YakovL@ImAnOwl

        Issue actions

          MySql /Mariadb error: max key length is 767 byte · Issue #4894 · gogs/gogs