Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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.

share|improve this question
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

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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