MySQL Forums
Forum List  »  MyISAM

"Specified key was too long. Max key length is 500" with a ALTER statement
Posted by: Stefan Hartmann
Date: August 07, 2009 04:53PM

Hello.

I have a problem with a MySQL query which don't work at my test server. It worked at several servers, but not at an old XAMPP. I search the reason and a workaround for it.

This is my table

CREATE TABLE IF NOT EXISTS `wa_configuration` (
`id` bigint(21) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`value` varchar(255) NOT NULL default '',
`module` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;

When I execute

ALTER TABLE `wa_configuration` ADD UNIQUE `name_and_module` (`name`, `module`)

I get the error

Specified key was too long. Max key length is 500

I use MySQL Client 5.0.67, Server 3.23.58-max-debug at a XAMPP for Win ME. (I use that system for downward compatibility tests, NOT as working system).

I read about the problem when using UTF8 in varchar(255) tables. But in that MySQL3, I think, that's not the reason. Why is there an error at ALTER TABLE while adding an unique symbol?

What is the reason and is there a workaround for this?

(Because my application is simple, I want to keep MySQL3, Apache1 and PHP4 support to it, so I am testing it at old systems to make it friendly to them)

Regards
S. Hartmann

Options: ReplyQuote


Subject
Views
Written By
Posted
"Specified key was too long. Max key length is 500" with a ALTER statement
5321
August 07, 2009 04:53PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.