You are here:Home»KB»Web Design»Media Wiki:Specified key was too long; max key length is 1024 bytes
Sunday, 16 November 2008 14:02

Media Wiki:Specified key was too long; max key length is 1024 bytes

Written by

During installation of MediaWiki you receive the following error:

Query "CREATE TABLE `job` ( job_id int(9) unsigned NOT NULL auto_increment, job_cmd varchar(255) NOT NULL default '', job_namespace int NOT NULL, job_title varchar(255) binary NOT NULL, job_params blob NOT NULL default '', PRIMARY KEY job_id (job_id), KEY (job_cmd, job_namespace, job_title) ) TYPE=InnoDB, DEFAULT CHARSET=utf8 " failed with error code "Specified key was too long; max key length is 1024 bytes (localhost)

or

Creating tables... using MySQL 4 table defs...Query "CREATE TABLE `job` ( job_id int(9) unsigned NOT NULL auto_increment, job_cmd varchar(255) NOT NULL default '', job_namespace int NOT NULL, job_title varchar(255) binary NOT NULL, job_params blob NOT NULL default '', PRIMARY KEY job_id (job_id), KEY (job_cmd, job_namespace, job_title) ) TYPE=InnoDB " failed with error code "Specified key was too long. Max key length is 500 (localhost)".

Fix

open file: tables.sql

Search for:

CREATE TABLE /*$wgDBprefix*/job (
 job_id int(9) unsigned NOT NULL auto_increment,
 
 -- Command name, currently only refreshLinks is defined
 job_cmd varchar(255) NOT NULL default '',

 -- Namespace and title to act on
 -- Should be 0 and '' if the command does not operate on a title
 job_namespace int NOT NULL,
 job_title varchar(255) binary NOT NULL,

 -- Any other parameters to the command
 -- Presently unused, format undefined
 job_params blob NOT NULL default '',

 PRIMARY KEY job_id (job_id),
 KEY (job_cmd, job_namespace, job_title)
) TYPE=InnoDB;

Replace With:

CREATE TABLE /*$wgDBprefix*/job (
 job_id int(9) unsigned NOT NULL auto_increment,
 
 -- Command name, currently only refreshLinks is defined
 job_cmd varchar(255) NOT NULL default '',

 -- Namespace and title to act on
 -- Should be 0 and '' if the command does not operate on a title
 job_namespace int NOT NULL,
 job_title varchar(255) binary NOT NULL,

 -- Any other parameters to the command
 -- Presently unused, format undefined
 job_params blob NOT NULL default '',

 PRIMARY KEY job_id (job_id),
 KEY (job_cmd (160), job_namespace, job_title (160))
) TYPE=InnoDB;

open file: /maintenance/tables.sql

Search for:

CREATE TABLE /*$wgDBprefix*/job (
 job_id int(9) unsigned NOT NULL auto_increment,
 
 -- Command name, currently only refreshLinks is defined
 job_cmd varchar(255) NOT NULL default '',

 -- Namespace and title to act on
 -- Should be 0 and '' if the command does not operate on a title
 job_namespace int NOT NULL,
 job_title varchar(255) binary NOT NULL,

 -- Any other parameters to the command
 -- Presently unused, format undefined
 job_params blob NOT NULL default '',

 PRIMARY KEY job_id (job_id),
 KEY (job_cmd, job_namespace, job_title)
) TYPE=InnoDB;

Replace With:

CREATE TABLE /*$wgDBprefix*/job (
 job_id int(9) unsigned NOT NULL auto_increment,
 
 -- Command name, currently only refreshLinks is defined
 job_cmd varchar(255) NOT NULL default '',

 -- Namespace and title to act on
 -- Should be 0 and '' if the command does not operate on a title
 job_namespace int NOT NULL,
 job_title varchar(255) binary NOT NULL,

 -- Any other parameters to the command
 -- Presently unused, format undefined
 job_params blob NOT NULL default '',

 PRIMARY KEY job_id (job_id),
 KEY (job_cmd (160), job_namespace, job_title (160))
) TYPE=InnoDB;

Run the Setup

After uploading the modified files you should now be able to install MediaWiki succesfully.

 

Read 1274 times Last modified on Saturday, 17 October 2009 22:03