[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: create table error


On Fri, 23 Mar 2001, Daniel Adams wrote:

> Can someone please tell me what the problem is below. All I am trying to 
> do is pipe a backup created with mysqldump into mysql and it gives me 
> this error:
> 
> ERROR 1071 at line 1291: Specified key was too long. Max key length is 
> 500

It is excactly what it says. Mysql cannot create keys whith length greater than 500 bytes. In your case name+description=255+255=510 bytes.
Try changing the last line to: 
KEY name (name(250),description(250))

It'll probably work, but still it'd be better if you truncated the 2 fields even more. For example it is highly unlikely you'll need more that the first 15 characters to discriminate between 2 names.

regards,
thalis

> 
> Here is the query where the error is:
> 
> 
> CREATE TABLE list (
>   list_id mediumint(8) unsigned NOT NULL auto_increment,
>   name varchar(255) DEFAULT '' NOT NULL,
>   description varchar(255),
>   email varchar(100) DEFAULT '' NOT NULL,
>   message_count mediumint(8) unsigned DEFAULT '0' NOT NULL,
>   category_id mediumint(8) unsigned DEFAULT '0' NOT NULL,
>   type tinyint(3) unsigned DEFAULT '0' NOT NULL,
>   day_count smallint(5) unsigned DEFAULT '0' NOT NULL,
>   num_days mediumint(8) unsigned DEFAULT '0' NOT NULL,
>   day_ave smallint(5) unsigned DEFAULT '0' NOT NULL,
>   PRIMARY KEY (list_id),
>   KEY type (type),
>   KEY category_id (category_id),
>   KEY name (name,description)
> )
> 
> 
> Thanks you in advance.
> 	- Dan
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <mysql-thread69362@xxxxxxxxxxxxxxx>
> To unsubscribe, e-mail <mysql-unsubscribe-thalis=cs.pitt.edu@xxxxxxxxxxxxxxx>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <mysql-thread69377@xxxxxxxxxxxxxxx>
To unsubscribe, e-mail <mysql-unsubscribe-treed=ultraviolet.org@xxxxxxxxxxxxxxx>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



This mailing list archive is a service of Copilot Consulting.