0

I created a couple of tables on phpmyadmin and now I return to them and I try to edit them and set their primary key as unsigned.

The type of the primary key is INT, the Length 11, Default is None, no collation, Not Null, AutoIncreament is true and no Attributes.

I try to change the Attributes to be Unsigned and I get the error

Query Error : £1025 - Error or rename of './mydatabase/£sql-de8a2_daa21b' to './mydatabase/mytable' (errno: 150)

Why I am getting this and how can I fix this?

Thank you

mitkosoft
  • 5,262
  • 1
  • 13
  • 31
slevin
  • 4,166
  • 20
  • 69
  • 129
  • Possible duplicate of http://stackoverflow.com/questions/4080611/1025-error-on-rename-of-database-sql-2e0f-1254ba7-to-database-table – eis Jun 06 '16 at 06:31

1 Answers1

1

I'm Sure that you are unable to edit cause of Foreign Key relation because there is another table with a foreign key referencing the primary key you are trying to change.

  • Use SHOW CREATE TABLE [table_name] to show the name of constraint.
  • Alter Table for drop foreign_key_constraint_name using ALTER TABLE [table_name] DROP FOREIGN KEY [foreign_key_constraint_name];
  • After that you can edit column name and apply again Foreign Key relation.
Piyush Gupta
  • 2,181
  • 3
  • 13
  • 28