Attempting to install Drupal 7.16 (also attempted 7.12) onto my local machine, I get the following error at the database stage.

SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Looking at the Drupal database with PHPMyAdmin, I see the "variables" table is created, together two columns; that is all that gets created prior to the error.

I can't find a single solution to this.

  • 1
    What is the definition of this table? – ypercubeᵀᴹ Nov 5 '12 at 19:29
  • How am I to find out? It's part of a drupal installation - I've no clue of what tables it's trying to create in the background - is there a way of knowing? – Alex Nov 5 '12 at 19:42
  • Why not check with the Drupal folks? drupal.stackexchange.com – Max Vernon Nov 5 '12 at 19:53
  • I tried there first - with no response 24 hours later :-( – Alex Nov 5 '12 at 19:59

This is probably due to the index limitations. From the MySQL docs: CREATE INDEX Syntax

Prefix support and lengths of prefixes (where supported) are storage engine dependent. For example, a prefix can be up to 1000 bytes long for MyISAM tables, and 767 bytes for InnoDB tables.

You probably have a VARCHAR column with length more than 767 or a TEXT column.

  • Thanks for your input - but how do I have any control over the tables? I haven't created them - they are part of the Drupal installation... – Alex Nov 5 '12 at 19:39
  • My guess is that the script used to run with older versions of MysQL (where the default is MyISAM) while yours is newer (where the default is InnoDB engine). If you can't find where the db scripts are created or you can't change them, you can try to manually login to the mysql server, set the default engine to MyISAM and then try again the installation. – ypercubeᵀᴹ Nov 5 '12 at 19:43
  • I tried adding the following line to my.cnf: default-storage-engine=MYISAM With no luck. How would I enable it from the cmd line? – Alex Nov 5 '12 at 19:49
  • Did you retsart the mysql service after doing the my.cnf change? It won't take effect otherwise. – ypercubeᵀᴹ Nov 5 '12 at 20:03
  • Yes I did. But I've finally solved it - I found the script used to create the tables, and chaged the engine to MyISAM - thanks to your suggestion. Really appreciate your help! – Alex Nov 5 '12 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.