Mysql Drop Index Error 150
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more
Error 1025 (hy000) Error On Rename Of (errno 150)
about Stack Overflow the company Business Learn more about hiring developers or posting ads error 1025 (hy000) error on rename of (errno 152) with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow
Mysql Error 1025 Errno 150
is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MySQL Error when dropping index (errno 150) up vote 8 down vote rails drop foreign key favorite 1 I've got problem with dropping foreign key index, I always get the same error ALTER TABLE `comments` DROP INDEX `id_user` which outputs 1025 - Error on rename of './postuj_cz1/#sql-d834_a0c704' to './postuj_cz1/comments' (errno: 150) The id_user on the other table is simple primary key index. I'm using MySQL version 5.0.85 mysql sql mysql-error-1025 share|improve this question edited Apr 30 '11 at 17:30 OMG Ponies 199k37360417 asked Sep 20 '09 cannot drop index needed in a foreign key constraint at 13:43 Jakub Arnold 32.3k62180262 1 Try dropping all foreign keys to the table first. –David Andres Sep 20 '09 at 13:47 Actually I don't have any fk to the table –Jakub Arnold Sep 20 '09 at 13:58 add a comment| 4 Answers 4 active oldest votes up vote 2 down vote accepted According to this link, the error relates to the definition of the primary key field. The error isn't about the foreign key index. Check the primary key for the COMMENTS table to make sure it does not have the UNSIGNED keyword while the COMMENTS.id_user foreign key had the UNSIGNED keyword. This keyword was causing the problem - inconsistent type of field. To fix, add the UNSIGNED keyword to the primary key definition for the COMMENTS table. Or remove the UNSIGNED keyword from the foreign key definition... share|improve this answer answered Sep 20 '09 at 16:28 OMG Ponies 199k37360417 add a comment| up vote 11 down vote There are other causes too. For example I had a unique index involving two separate foreign key columns. I had to drop the foreign keys in question before I could drop the unique index. (And obviously you can add the foreign keys back a
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers
Error 1025 Outlook Mac
or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x laravel drop foreign key Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it
Error Code 1025 Outlook Mac
only takes a minute: Sign up #1025 - Error on rename of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150) up vote 59 down vote favorite 13 So I am trying to add a primary key to one of the tables in my http://stackoverflow.com/questions/1451042/mysql-error-when-dropping-index-errno-150 database. Right now it has a primary key like this: PRIMARY KEY (user_id, round_number) Where user_id is a foreign key. I am trying to change it to this: PRIMARY KEY (user_id, round_number, created_at) I am doing this in phpmyadmin by clicking on the primary key icon in the table structure view. This is the error I get: #1025 - Error on rename of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150) It is a MySQL database with InnoDB table engine. mysql sql phpmyadmin http://stackoverflow.com/questions/4080611/1025-error-on-rename-of-database-sql-2e0f-1254ba7-to-database-table innodb mysql-error-1025 share|improve this question edited Apr 30 '11 at 17:29 OMG Ponies 199k37360417 asked Nov 2 '10 at 17:55 Richard Knop 23.6k95284462 1 A quick search using Google gives me the idea that this problem is related to constraints. Possible helpful links: dev.mysql.com/doc/refman/5.0/en/innodb-error-codes.html and simplicidade.org/notes/archives/2008/03/mysql_errno_150.html –Lekensteyn Nov 2 '10 at 18:01 add a comment| 6 Answers 6 active oldest votes up vote 104 down vote accepted There is probably another table with a foreign key referencing the primary key you are trying to change. To find out which table caused the error you can run SHOW ENGINE INNODB STATUS and then look at the LATEST FOREIGN KEY ERROR section. share|improve this answer edited Nov 20 '14 at 11:00 trejder 6,5031366131 answered Nov 2 '10 at 18:50 Ike Walker 33.6k95278 add a comment| up vote 18 down vote For those who are getting to this question via google... this error can also happen if you try to rename a field that is acting as a foreign key. share|improve this answer answered Jun 20 '13 at 13:03 Dave C 267521 add a comment| up vote 18 down vote As was said you need to remove the FKs before. On Mysql do it like this: ALTER TABLE `table_name` DROP FOREIGN KEY `id_name_fk`; ALTER TABLE `table_name` DROP INDEX `id_name_fk`; share|improve this answer edited Sep 28 at 12:31 answered Sep 4 '13 at 21:04 Wellington Lorindo 1,189814 add a comment| up
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more http://stackoverflow.com/questions/7655310/mysql-drop-field-foreign-key-errorno-150 about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MySQL drop field; foreign key errorno 150 up vote 4 down vote favorite Problems with MySQL using InnoDB and dropping an unused, foreign key. The foreign key references error 1025 another table's id. However, I don't need this field. I've tried removing the fk index, which doesn't work - says it's needed in a foreign key contraint. And removing the field, which gives me an error: 1025 - Error on rename of './axis/#sql-ad8_1531' to './axis/Schedule' (errno: 150) The table is currently empty. There are no tables referencing this field. Any ideas on how to get rid of this? Other than creating a new table? If I'm reading error 1025 (hy000) the below error correctly, I can't drop the column since the fk index is declared. And I can't drop the index, because the column exists. Chicken & Egg?? LATEST FOREIGN KEY ERROR 111004 17:05:40 Error in foreign key constraint of table axis/Schedule: there is no index in the table which would contain the columns as the first columns, or the data types in the table do not match the ones in the referenced table or one of the ON ... SET NULL columns is declared NOT NULL. Constraint: , CONSTRAINT "fk_Schedule_Grp" FOREIGN KEY ("idGrp") REFERENCES "Grp" ("idGrp") ON DELETE NO ACTION ON UPDATE NO ACTION InnoDB: Renaming table axis. to axis.Schedule failed! mysql foreign-keys share|improve this question edited Oct 5 '11 at 0:11 asked Oct 4 '11 at 23:54 Logan Klenner 1211512 add a comment| 1 Answer 1 active oldest votes up vote 12 down vote accepted You need to use ALTER TABLE table_name DROP FOREIGN KEY constraint_name Here constraint_name is the name of the constraint rather than the index. If you do not know what this is, you can find out by issuing a SHOW CREATE TABLE. It is the identifier that appears after the word CONSTRAINT. Edit: From your addition to the question, it looks like you need to issue ALTER TABLE table_name DROP FOREIGN KEY fk_Schedule_Grp share|improve this answer answered Oct 5 '11 at 0:11 Hammerite 13.5k239