I keep getting this mysql error code #1089

after selecting PRIMARY KEY when you create table, don't input any value in pop dialog


With the part

PRIMARY KEY (`movie_id`(3))

you are telling mysql to create a sub part key* on the first 3 Bytes of movie id. This only works for string types.

You need to use

PRIMARY KEY (`movie_id`)

without providing a length.

*Is this sure the query resulting in the error? Never saw that on a primary key, its used for indexes.


You can also get this error when creating an index if you specify a prefix length that is longer than the length of the actual column. If you tried to create an index containing someColumn(20) but in the table someColumn is VARCHAR(15), then this error will occur.

Tags:

Mysql