Mysql Error Number 1025 Errno 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
Error 1025 (hy000) Error On Rename Of (errno 152)
more about Stack Overflow the company Business Learn more about hiring developers or posting mysql error 1025 errno 150 ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack
Error 1025 Outlook Mac
Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What does mysql error 1025 (HY000): Error on rename of './foo' error code 1025 outlook mac (errorno: 150) mean? up vote 123 down vote favorite 47 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 Dec 5 '09 at 7:00 OMG Ponies 199k37360417 asked Oct 1 '08 at 23:33 Trenton 3,56063238 @skiphoppy - how to drop foreign key in mysql 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 181 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 index, something like this: CONSTRAINT region_ibfk_1 FOREIGN KEY (country_id) REFERENCES country (id) ON DELETE NO ACTION ON UPDATE NO ACTION Now simply issue an: alter table region drop foreign key region_ibfk_1; And finally an: alter table region drop column country_id; And you
here for a quick overview of the site Help Center
Mysql Rename Foreign Key
Detailed answers to any questions you might have Meta Discuss alembic drop foreign key the workings and policies of this site About Us Learn more about Stack Overflow
Laravel Drop Foreign Key
the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x http://stackoverflow.com/questions/160233/what-does-mysql-error-1025-hy000-error-on-rename-of-foo-errorno-150-me 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 (Bug?) InnoDB MySQL error 1025, errno 150 Foreign Key up vote 3 down vote favorite I have a table http://stackoverflow.com/questions/15100545/bug-innodb-mysql-error-1025-errno-150-foreign-key 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) 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 o
Hugo. RSS Feed. Baron Schwartz's Blog MySQL's ERROR 1025 explained Tue, Aug 22, 2006 in Databases MySQL issues a http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/ cryptic error message, “Error on rename,” when you try to alter a table in such a way that it would break a foreign key constraint: create table test1(a int not null primary key)engine=innodb; create table test2(a int not null, foreign key(a) references test1 (a)) engine=innodb; alter table test2 modify a foreign key smallint not null; ERROR 1025 (HY000): Error on rename of './test/#sql-2fa8_1' to './test/test2' (errno: 150) This happens because ALTER TABLE really works by making a copy of the table, then renaming to move the old table out of the way and move the new table into its place. It is drop foreign key certainly one of the less meaningful error messages I’ve seen in MySQL. There’s slightly more information in the output of SHOW ENGINE INNODB STATUS, if you are looking there (of course, if you’re looking there you’re probably already clued in to what’s going on). And innotop can parse that information for you: In case you didn’t understand why the foreign key constraint was failing, the error message innotop parses out is much clearer. It’s because the foreign key columns in the parent and child table have to have the same data type. I was trying to change the child’s column to an incompatible type. I'm Baron Schwartz, the founder and CEO of VividCortex. I am the author of High Performance MySQL and many open-source tools for performance analysis, monitoring, and system administration. I contribute to various database communities such as Oracle, PostgreSQL, Redis and MongoDB. Newer Older Comments