#1025 - Error On Rename Of Drop Foreign Key
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta error 1025 (hy000) error on rename of (errno 150) Discuss the workings and policies of this site About Us Learn more
Error 1025 (hy000) Error On Rename Of (errno 152)
about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack general error: 1025 error on rename of laravel Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping mysql error 1025 errno 150 each other. Join them; it only takes a minute: Sign up #1025 - Error on rename of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150) up vote 57 down vote favorite 13 So I am trying to add a primary key to one of the tables in my database. Right now it has a primary key like this: PRIMARY KEY
Error 1025 Outlook Mac
(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 innodb mysql-error-1025 share|improve this question edited Apr 30 '11 at 17:29 OMG Ponies 198k36356415 asked Nov 2 '10 at 17:55 Richard Knop 23.3k94279461 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 100 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 th
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss error code 1025 outlook mac the workings and policies of this site About Us Learn more about laravel drop foreign key Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow
Alembic Drop Foreign Key
Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each http://stackoverflow.com/questions/4080611/1025-error-on-rename-of-database-sql-2e0f-1254ba7-to-database-table other. Join them; it only takes a minute: Sign up unable to drop the foreign key up vote 15 down vote favorite 2 I would like to drop the foreign key in my table but been into this error message mysql> alter table customers drop foreign key customerid; ERROR 1025 (HY000): Error on rename of '.\products\customers' to '.\products\#sql2-7ec-a3' (errno: http://stackoverflow.com/questions/10632587/unable-to-drop-the-foreign-key 152) mysql> mysql foreign-keys foreign-key-relationship mysql-error-1025 share|improve this question edited May 17 '12 at 9:18 Fahim Parkar 15.7k2294193 asked May 17 '12 at 8:57 solomon 1171210 1 This may help you to understand stackoverflow.com/questions/160233/… –Imdad May 17 '12 at 9:04 @Imdad This link describes another error - (errno: 150) –Devart May 17 '12 at 9:17 Try this. Create new table (without foreign key constraint). copy the data to new table (using syntax INSERT INTO new_table SELECT * FROM old_table) Drop the old table –Imdad May 17 '12 at 9:22 Have you checked @Maksym Polshcha's answer? You have to use the foreign key's name not the column name. (it might be something like fk_customerid) –Imdad May 17 '12 at 9:24 check my answer and let me know if you still have problem... –Fahim Parkar May 17 '12 at 9:37 | show 1 more comment 4 Answers 4 active oldest votes up vote 4 down vote accepted To avoid getting this error while trying to d
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and http://dba.stackexchange.com/questions/86853/1025-error-on-rename-of-table-errno-150-table-was-deleted-while-tried-to-a policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join error on them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top #1025 - Error on rename of table errno: 150 : Table was deleted while tried to assign foreign key up vote 1 down vote favorite When I tried to assign foreign error on rename key to a table named mydb.table1 it was deleted from my database, I could not understand the reason and tried to move on. For this tried to create same table with create SQL but it says #1005 - Can't create table 'mydb.table1' (errno: 150) Now I created same schema table with table name table2, this was successfully created but as my application code is written for table1, I need to rename this table to table1 again on which gives me following error. #1025 - Error on rename of table errno: 150 Also tried to run alter table query with set foreign_key_checks = 0. But same error. While searching I came accross below SQL, SHOW INNODB ENGINE STATUS; Which displays following message 141223 11:30:10 Error in foreign key constraint of table myahd/table1: 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_key9" FOREIGN KEY ("updated_by") REFERENCES "users" ("userid")