skip to Main Content

I am trying to create a new table using the mysql GUI in phpmyadmin. This is the error I am getting #1072 – Key column ‘id ‘ doesn’t exist in table

CREATE TABLE `loginsys`.`groups`(
    `id` INT NOT NULL AUTO_INCREMENT,
    `name` VARCHAR(20) NOT NULL,
    `permission` TEXT NOT NULL,
    PRIMARY KEY(`id `)
) ENGINE = InnoDB

2

Answers


  1. simply run the query without “`”

    CREATE TABLE loginsys.groups(
    id INT NOT NULL AUTO_INCREMENT,
    name VARCHAR(20) NOT NULL,
    permission TEXT NOT NULL,
    PRIMARY KEY(id))

    Login or Signup to reply.
  2. Please correct the extra space in when you’re defining PRIMARY KEY(id )

    This should be your query :-

    CREATE TABLE `loginsys`.`groups`(
        `id` INT NOT NULL AUTO_INCREMENT,
        `name` VARCHAR(20) NOT NULL,
        `permission` TEXT NOT NULL,
        PRIMARY KEY(`id`)
    ) ENGINE = InnoDB
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search