CREATE TABLE `table`.`users` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`username` VARCHAR(50) NOT NULL,
`password` VARCHAR(50) NOT NULL,
`dir` VARCHAR(
In PHPMyAdmin, Ignore / leave the size value empty on the pop-up window.
In your PRIMARY KEY definition you've used (id(11))
, which defines a prefix key - i.e. the first 11 characters only should be used to create an index. Prefix keys are only valid for CHAR
, VARCHAR
, BINARY
and VARBINARY
types and your id
field is an int
, hence the error.
Use PRIMARY KEY (id)
instead and you should be fine.
MySQL reference here and read from paragraph 4.
Here the full solution step by step
here is the solution
(id (11))
this on bottom of the code(id (11))
into (id)
boom now you will be fine
This
PRIMARY KEY (
id
(11))
is generated automatically by phpmyadmin, change to
PRIMARY KEY (
id
)
.
When you give id as a primary key then a pop up is come and those aske you to how many size of this primary key. So you just leave blank because by default int value is set 11. Click then ok on those pop up without any enter a number. in this type of error never will you face in future. Thank you
If you are using a GUI and you are still getting the same problem. Just leave the size value empty, the primary key defaults the value to 11, you should be fine with this. Worked with Bitnami phpmyadmin.