Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • ERROR: Error 1005: Can't create table (errno: 121)

    • 0
    • 4
    • 1
    • 3
    • 0
    • 0
    • 0
    • 0
    • 596
    Comment on it

    Sometimes we get this error on creating table in MySQL.This error will come when we use the constraint with the same name that is already used somewhere else.

    If the table you're trying to create includes a foreign key constraint, and you've provided a name for that constraint, then remember that it must be unique within the whole database. Run the below query to see if that name is in use somewhere in the database:

    SELECT
      constraint_name,
      table_name
    FROM
      information_schema.table_constraints
    WHERE
      constraint_type = 'FOREIGN KEY'
      AND table_schema = DATABASE()
    ORDER BY
      constraint_name;
    

    Hope this will help you :)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: