Questions tagged [mysql-error-1071]

Error 1071: Specified key was too long; max key length is # bytes. # can be 1000 for MyISAM, 767 for InnoDB.

Error 1071: Specified key was too long; max key length is # bytes. # can be 1000 for MyISAM, 767 for InnoDB.

This is by design - quote:

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.

15 questions
663
votes
37 answers

MySQL Error #1071 - Specified key was too long; max key length is 767 bytes

When I executed the following command: ALTER TABLE `mytable` ADD UNIQUE ( `column1` , `column2` ); I got this error message: #1071 - Specified key was too long; max key length is 767 bytes Information about column1 and column2: column1 varchar(20)…
Steven
  • 24,410
  • 42
  • 108
  • 130
28
votes
4 answers

Mysql::Error: Specified key was too long; max key length is 1000 bytes

script/generate acts_as_taggable_on_migration rake db:migrate causes Mysql::Error: Specified key was too long; max key length is 1000 bytes: CREATE INDEX `index_taggings_on_taggable_id_and_taggable_type_and_context` ON `taggings` (`taggable_id`,…
amaseuk
  • 2,147
  • 4
  • 24
  • 43
6
votes
2 answers

Error during django's syncdb on server

I have a full operating locale django app, but I'm having troubles while migrating to the site5 server. When I launch django's syncdb command, all my models' tables are created, but then (I guess when it's creating relationship tables), I got the…
dolma33
  • 4,133
  • 6
  • 28
  • 48
4
votes
4 answers

What's wrong with this statement?

mysql> create table newsgroup( -> id integer unsigned NOT NULL AUTO_INCREMENT, -> creater integer unsigned NOT NULL, -> coremember integer unsigned DEFAULT NULL, -> name varchar(300) not null unique, -> description text, …
user198729
  • 61,774
  • 108
  • 250
  • 348
3
votes
2 answers

Getting ERROR 1701, ERROR 1452 and ERROR 1305 errors in MySQL - Need some expertise

This is my first real crack at making a database in Third Normal Form. I managed to create the DDL script ok (I had the logical model verified to 3NF before I went ahead and built the script) but I get a whole lot of errors I am unsure of fixing. I…
Rob
  • 1,272
  • 6
  • 24
  • 35
2
votes
4 answers

Enforce unique rows in MySQL

I have a table in MySQL that has 3 fields and I want to enforce uniqueness among two of the fields. Here is the table DDL: CREATE TABLE `CLIENT_NAMES` ( `ID` int(11) NOT NULL auto_increment, `CLIENT_NAME` varchar(500) NOT NULL, `OWNER_ID` int(11)…
Mike Farmer
  • 2,992
  • 4
  • 28
  • 32
2
votes
2 answers

#1071 - Specified key was too long; max key length is 767 bytes

I this SQL query to create a table: CREATE TABLE IF NOT EXISTS `local_sysDB`.`hashtags` ( `id` INT NOT NULL AUTO_INCREMENT, `hashtag` VARCHAR(255) NOT NULL COMMENT 'hashtag must be unique. Must be saved without #', `accountId` INT NULL, …
user936965
2
votes
3 answers

PIG UDF in JAVA ERROR 1070

I have created UDF_UPPER.jar file in /home/GED385/pigScripts. [GED385@snshadoope1 pigScripts]$ jar tf /home/GED385/pigScripts/UDF_UPPER.jar | grep UPPER UPPER.class But while executing the pig i am getting below error. grunt> exec…
2
votes
3 answers

mysql ERROR 1071 (Specified key was too long; max key length is 1000 bytes) in simple dump-import setting

dump mysql db on server 1 $ mysql --version mysql Ver 14.14 Distrib 5.1.54, for debian-linux-gnu (x86_64) using readline 6.2 $ mysqldump -u root -p db > db.sql import on server 2 $ mysql --version mysql Ver 14.12 Distrib 5.0.95, for…
Viktor Trón
  • 8,774
  • 4
  • 45
  • 48
1
vote
3 answers

mysql key was too long issue

i was trying to import my backup after ive change the charset to utf8 from latin1 , now during my import i got this error ERROR 1071 (42000) at line 2137: Specified key was too long; max key length is 1000 bytes try to change my.cnf and set all…
user172697
  • 155
  • 1
  • 11
1
vote
0 answers

MySQL Error code 1071 After applying multiple changes

I recently received a Lumen/Laravel project which came with an sql file created already by the other developers. While trying to set it up in my system(already set up the environment with the required configurations in MySQL workbench) I kept…
1
vote
0 answers

Wordpress database error- #1071 - Specified key was too long; max key length is 1000 bytes

I have a WordPress blog but it has some strange characters in the content like �. I found in my phpmyadmin, that in my wp_posts table, the column post_content is using latin1_swedish_ci collation. I am trying to change it to utf8_unicode_ci but it's…
1
vote
4 answers

Error: #1071 - Specified key was too long; max key length is 1000 bytes - mysql 5.0.91

I am using mysql 5.0.91 and I need to save URLs ( some are small and some are very long ). I want to use varchar(2000) but I get an error: #1071 - Specified key was too long; max key length is 1000 bytes What is the best way to save URLs on my…
0
votes
1 answer

My SQL Script erro 1071 - Does Not Work ADD UNIQUE or Change ENGINE

`CREATE TABLE IF NOT EXISTS `Odin`.`Usuario` ( `CodUsuario` INT NOT NULL AUTO_INCREMENT, `CodTipoUsuario` INT NOT NULL, `CodConsultorTecnico` INT NULL, `CodProdutor` INT NULL, `Login` VARCHAR(255) CHARACTER SET 'utf8mb4' NOT NULL, …
0
votes
1 answer

how do I circumvent the max key length in mySQL?

I'm creating a table indexing a lot of measurements, distributed in various files. In a different table, for a different type of data, I have used the absolute path to the data-file as a unique index. That has worked quite well. However, when I now…
Kaare
  • 531
  • 1
  • 7
  • 26