Forums | Mahara Community

Support /
1071: Specified key was too long (utf8mb4 and VARCHAR(255) Primary Key)


08 February 2021, 7:58

Hello

I'm trying to install Mahara 20.10.0 (2020092107)  on a shared hosting environement. This enviromnent does not support the latest version of PostgreSQL, so I'm having to use MySql instead.

I've created the database using UFT8MB4 as directed by the Mahara installation scripts.

I'm getting the following error in the "Update Core" step:

(lib/dml.php:181) mysqli error: [1071: Specified key was too long; max key length is 767 bytes] in EXECUTE("CREATE TABLE config (
    field VARCHAR(255) NOT NULL,
    value LONGTEXT,
CONSTRAINT  PRIMARY KEY (field)
)ENGINE=innodb")Command was: CREATE TABLE config (
    field VARCHAR(255) NOT NULL,
    value LONGTEXT,
CONSTRAINT  PRIMARY KEY (field)
)ENGINE=innodb

I'm getting similar error for table which are attempting to use BIGINT as the primary key.

Looking this up, it seems that I would need to set an innodb system variable to innodb_large_prefix = true to get around this, but I don't think I have permission to do that in the shared environment. 

Any suggestions?

Guillaume

Robert Lyon's profile picture
Posts: 749

09 February 2021, 9:55

Hi Guillaume,

Ok the issue sounds like what is mentioned here
https://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes

So I'm assuming the MySql is version 5.6 - because the 'field' column has 255 chars it needs 255 * 4 = 1080 bytes needed 

Is it possible for you to upgrade to a newer version? I see MySql 5.7 allows 3072 bytes

Cheers

Robert

 

09 February 2021, 11:17

Hi Robert.

Let me check with the hosting company to see if they plan to upgrade.

I'll let you know if that solves it.

Thanks again for your prompt and informed assistance.

GUillaume

Kristina Hoeppner's profile picture
Posts: 4717

09 February 2021, 22:25

Hi Guillaume,

What do you mean with 'latest Postgres'? You can still use Mahara with the older Postgres 9.4+.

Cheers

Kristina

10 February 2021, 11:03

Hi Kristina,

Sorry, I should have explained, my hosted environment is a little bit lagging, we're not on PostGres 9.4 yet, so I get the following message:

Your database server version is not new enough to successfully run Mahara. Your server is PostgreSQL 8.4.20, but Mahara requires at least version 9.3.

But I'm told that I'm due to be upgraded soon, so I'll be patient... #twiddlingthumbs

 

Guillaume

Kristina Hoeppner's profile picture
Posts: 4717

12 February 2021, 9:31

Hi Guillaume,

I hope you don't have to wait too long.

Cheers

Kristina

6 results