LesteTheMolesterCockensch
@LesteTheMolesterCockensch
Web developer

Не могу создать таблицу в базе данных, ошибка #1709 — Index column size too large, как это исправить?

В PhpMyAdmin ввожу запрос:

CREATE TABLE `privs` (
`id_priv` int(5) NOT NULL auto_increment,
`name` varchar(256) NOT NULL,
`description` varchar(512) default NULL,
PRIMARY KEY (`id_priv`),
UNIQUE KEY `name` (`name`)
);

после чего выскакивает ошибка: #1709 - Index column size too large. The maximum column size is 767 bytes.

Что сделать чтобы заработало?)
  • Вопрос задан
  • 5490 просмотров
Решения вопроса 1
vyachin
@vyachin
Ищу работу
dev.mysql.com/doc/refman/5.6/en/innodb-restriction...

By default, an index key for a single-column index can be up to 767 bytes. The same length limit applies to any index key prefix. See Section 13.1.13, “CREATE INDEX Syntax”. For example, you might hit this limit with a column prefix index of more than 255 characters on a TEXT or VARCHAR column, assuming a UTF-8 character set and the maximum of 3 bytes for each character. When the innodb_large_prefix configuration option is enabled, this length limit is raised to 3072 bytes, for InnoDB tables that use the DYNAMIC and COMPRESSED row formats.
1. можно уменьшить длину поля name до 255 символов
2. поменять engine для таблицы на myisam (например)
3. установить innodb_large_prefix = true в конфиге и у таблицы указать формат строк DYNAMIC или COMPRESSED (написано в доке см выше)
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы