Errno 150 Error On Rename
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 error 1025 (hy000) error on rename of (errno 152) About Us Learn more about Stack Overflow the company Business Learn more about
Mysql Error 1025 Errno 150
hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
General Error 1025 Error On Rename Of Laravel
the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up #1025 - Error on rename
Error 1025 Outlook Mac
of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150) up vote 58 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 (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 mysql rename foreign key 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.4k95284462 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 101 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,4601365131 answered Nov 2 '10 at 18:50 Ike Walker 33.4k95278 add a comment| up vote 18 down vote For those who are getting to this question via google... this e
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies error code 1025 outlook mac of this site About Us Learn more about Stack Overflow the company how to drop foreign key in mysql Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users alembic drop foreign key 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 other. Join them; it only takes a http://stackoverflow.com/questions/4080611/1025-error-on-rename-of-database-sql-2e0f-1254ba7-to-database-table minute: Sign up What does mysql error 1025 (HY000): Error on rename of './foo' (errorno: 150) mean? up vote 122 down vote favorite 46 I tried this in mysql: mysql> alter table region drop column country_id; And got this: ERROR 1025 (HY000): Error on rename of './product/#sql-14ae_81' to './product/region' (errno: 150) Any ideas? Foreign key stuff? mysql mysql-error-1025 share|improve this question edited http://stackoverflow.com/questions/160233/what-does-mysql-error-1025-hy000-error-on-rename-of-foo-errorno-150-me Dec 5 '09 at 7:00 OMG Ponies 198k36356415 asked Oct 1 '08 at 23:33 Trenton 3,53563238 @skiphoppy - Are you trying to give a bounty to an already-given-answer? Is that even allowed? Or is your case different, in which case you should start another thread? –Rick James Jan 9 at 6:35 @RickJames Yes it is. However, skiphoppy should add her comment under the answer she elected, as the bouty message will disappear when the bounty is over. –RandomSeed Jan 11 at 15:25 add a comment| 10 Answers 10 active oldest votes up vote 179 down vote accepted You usually get this error if your tables use the InnoDB engine. In that case you would have to drop the foreign key, and then do the alter table and drop the column. But the tricky part is that you can't drop the foreign key using the column name, but instead you would have to find the name used to index it. To find that, issue the following select: SHOW CREATE TABLE region; This should show you the name of the
here for a quick overview of the site Help Center Detailed answers to any questions you might have http://stackoverflow.com/questions/15100545/bug-innodb-mysql-error-1025-errno-150-foreign-key Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more 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 4.7 million programmers, error 1025 just like you, helping each other. Join them; it only takes a minute: Sign up (Bug?) InnoDB MySQL error 1025, errno 150 Foreign Key up vote 3 down vote favorite I have a table whose primary key I'm trying to change. this is the table definition. CREATE TABLE `tbl_customer` ( `PersonId` int(11) NOT NULL, `Id` int(10) error on rename unsigned NOT NULL, `Name` varchar(100) collate utf8_spanish_ci NOT NULL, `Alias` varchar(50) collate utf8_spanish_ci NOT NULL, `Phone` varchar(30) collate utf8_spanish_ci default NULL, `Phone2` varchar(30) collate utf8_spanish_ci default NULL, `Email` varchar(50) collate utf8_spanish_ci default NULL, `Email2` varchar(50) collate utf8_spanish_ci default NULL, `RFC` varchar(13) collate utf8_spanish_ci default NULL, `AddressStreetName` varchar(45) collate utf8_spanish_ci default NULL, `AddressStreetNumber` varchar(45) collate utf8_spanish_ci default NULL, `AddressCityWard` varchar(45) collate utf8_spanish_ci default NULL, `AddressCityName` varchar(45) collate utf8_spanish_ci default NULL, `AddressStateName` varchar(45) collate utf8_spanish_ci default NULL, `AddressCountryName` varchar(45) collate utf8_spanish_ci default NULL, `AddressPostalCode` int(10) default NULL, `IsDistributor` tinyint(1) NOT NULL default '0' COMMENT '1 = Is Distributor, 0 = Is Not Distributor', `ParentCustomerId` int(10) NOT NULL default '11' COMMENT 'Our Id is 11, so by default, all customers right now are our children.', PRIMARY KEY (`Id`), KEY `fk_tbl_cliente_tbl_cliente1_idx` (`ParentCustomerId`), KEY `fk_tbl_cliente_tbl_person1_idx` (`PersonId`), KEY `PersonId` (`PersonId`), KEY `PersonId_2` (`PersonId`), CONSTRAINT `fk_tbl_cliente_tbl_cliente1` FOREIGN KEY (`ParentCustomerId`) REFERENCES `tbl_customer` (`PersonId`), CONSTRAINT `fk_tbl_cliente_tbl_person1` FOREIGN KEY (`PersonId`) REFERENCES `zapata`.`tbl_person` (`Id`) ON DELETE NO ACTION ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci COMMENT='''Custome