Mysql Drop Key Error Code 1025
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 about Stack Overflow the company Business Learn more about error 1025 (hy000) error on rename of (errno 150) hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges error 1025 (hy000) error on rename of (errno 152) 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. mysql error 1025 errno 150 Join them; it only takes a minute: Sign up What does mysql error 1025 (HY000): Error on rename of './foo' (errorno: 150) mean? up vote 123 down vote favorite 47 I tried this in mysql: mysql> alter table region
General Error: 1025 Error On Rename Of Laravel
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 - 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 error code 1025 outlook mac 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 are good to go! share|improve this answer answered Apr 11 '11 at 0:45 Jeshurun 13.3k45069 7 If I could upvote this twice I would. Cheers! Great walk through. –Rudiger Mar 1 '12 at 3:19 9 This should be the correct answer.Thanks! –PinoyStackOverflower Jul 17 '12 at 14:12 You saved my bacon. Thanks fo
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the error 1025 outlook mac workings and policies of this site About Us Learn more about Stack
How To Drop Foreign Key In Mysql
Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions
Alembic Drop Foreign Key
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 http://stackoverflow.com/questions/160233/what-does-mysql-error-1025-hy000-error-on-rename-of-foo-errorno-150-me them; it only takes a minute: Sign up Help with: ERROR 1025 (HY000): Error on rename of … (errno: 150) up vote 35 down vote favorite 7 I am getting this error when I am trying to run an alter table command to drop a column: ERROR 1025 (HY000): Error on rename of .... (errno: 150). If I understand http://stackoverflow.com/questions/5948704/help-with-error-1025-hy000-error-on-rename-of-errno-150 correctly it is a foreign key problem, but I do not have a clue how to fix it. Would somebody be so kind and tell me how to get it working. The code used for creating table: CREATE TABLE categories( cid INT AUTO_INCREMENT NOT NULL PRIMARY KEY, assets_id INT NOT NULL, cat_name VARCHAR(30) NOT NULL, INDEX(assets_id), FOREIGN KEY (assets_id) REFERENCES asset(aid) ON UPDATE CASCADE ) ENGINE=INNODB DEFAULT CHARSET=utf8; The alter command: ALTER TABLE categories DROP COLUMN assets_id; The table categories is completely blank. So there is no information to set off the CASCADE restrictions. So could you help me what kind of wizardry do I need to delete the column assets_id. Thank you. mysql share|improve this question edited May 10 '11 at 10:50 Manoj 3,43574364 asked May 10 '11 at 10:31 Henkka 3623817 add a comment| 3 Answers 3 active oldest votes up vote 66 down vote accepted Use SHOW CREATE TABLE categories to show the name of constraint. Most probably it will be categories_ibfk_1 Use the name to drop the foreign key first a
Verified Impact on me: None Category:MySQL Server: Parser Severity:S2 (Serious) Version:5.0.15, 5.0.74, https://bugs.mysql.com/bug.php?id=14347 5.1.30, 6.0.9 OS:Linux (Linux Suse 10, Windows) Assigned to: Tags: foreign key, innodb Triage: Triaged: D5 (Feature request) View Add Comment Files Developer Edit Submission View Progress Log Contributions [26 Oct 2005 18:53] Vadim Tkachenko Description: When I try ALTER TABLE ORDERS DROP FOREIGN KEY CUSTOMERID; I error 1025 got: ERROR 1025 (HY000): Error on rename of './TESTDB/ORDERS' to './TESTDB/#sql2-3b5b-8' (errno: 152) But I only want to remove FOREIGN KEY and I don't delete any rows. How to repeat: DROP TABLE IF EXISTS `ORDERS`; CREATE TABLE `ORDERS` ( `ORDERID` int(11) NOT NULL auto_increment, `ORDERDATE` date NOT NULL, error on rename `CUSTOMERID` int(11) default NULL, `NETAMOUNT` decimal(12,2) NOT NULL, `TAX` decimal(12,2) NOT NULL, `TOTALAMOUNT` decimal(12,2) NOT NULL, PRIMARY KEY (`ORDERID`), KEY `IX_ORDER_CUSTID` (`CUSTOMERID`), CONSTRAINT `FK_CUSTOMERID` FOREIGN KEY (`CUSTOMERID`) REFERENCES `CUSTOMERS` (`CUSTOMERID`) ON DELETE SET NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; DROP TABLE IF EXISTS `CUSTOMERS`; CREATE TABLE `CUSTOMERS` ( `CUSTOMERID` int(11) NOT NULL auto_increment, `FIRSTNAME` varchar(50) NOT NULL, `LASTNAME` varchar(50) NOT NULL, `ADDRESS1` varchar(50) NOT NULL, `ADDRESS2` varchar(50) default NULL, `CITY` varchar(50) NOT NULL, `STATE` varchar(50) default NULL, `ZIP` int(11) default NULL, `COUNTRY` varchar(50) NOT NULL, `REGION` tinyint(4) NOT NULL, `EMAIL` varchar(50) default NULL, `PHONE` varchar(50) default NULL, `CREDITCARDTYPE` int(11) NOT NULL, `CREDITCARD` varchar(50) NOT NULL, `CREDITCARDEXPIRATION` varchar(50) NOT NULL, `USERNAME` varchar(50) NOT NULL, `PASSWORD` varchar(50) NOT NULL, `AGE` tinyint(4) default NULL, `INCOME` int(11) default NULL, `GENDER` varchar(1) default NULL, PRIMARY KEY (`CUSTOMERID`), UNIQUE KEY `IX_CUST_USERNAME` (`USERNAME`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `CUST