#1025 - Error On Rename Phpmyadmin
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and
Mysql 1025 Error On Rename
policies of this site About Us Learn more about Stack Overflow the error 1025 (hy000): error on rename of company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
Error 1025 (hy000) Error On Rename Of (errno 152)
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 other. Join them; it only error 1025 (hy000) error on rename of (errno 150) 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 (user_id, round_number) Where user_id is a foreign key. I am rename phpmyadmin database 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 then look at the LATEST FOREIGN KEY ERROR section. share|improve this answer edited Nov 20 '14 at 11:00 trejder 6,44013
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
Rename Phpmyadmin Folder
Stack Overflow the company Business Learn more about hiring developers or posting ads with error 1025 outlook mac us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is
Error Code 1025 Outlook Mac
a community of 4.7 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' (errorno: 150) mean? http://stackoverflow.com/questions/4080611/1025-error-on-rename-of-database-sql-2e0f-1254ba7-to-database-table 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 Dec 5 '09 at 7:00 OMG Ponies 198k36356415 asked Oct 1 '08 at 23:33 Trenton 3,52563238 @skiphoppy - Are you trying to give http://stackoverflow.com/questions/160233/what-does-mysql-error-1025-hy000-error-on-rename-of-foo-errorno-150-me 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 177 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 Ap
Community Podcasts MySQL.com Downloads Documentation Section Menu: MySQL Forums :: InnoDB :: errno 150 - foreign key problems New Topic Advanced Search errno 150 - foreign key problems Posted by: Paul Blazek () Date: http://forums.mysql.com/read.php?22,95361 June 09, 2006 03:50PM I'm using 5.0.19 on Linux and MySQL Admin 1.1.9. http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/ I was changing column names in some tables with foreign key references, and I am now at the point that I cannot change a table from MyISAM to InnoDB due to a non-existant foreign key constraint. SHOW CREATE TABLE FUN_Function yields: CREATE TABLE `FUN_Function` ( `FUNlFunctionKey` int(11) NOT NULL default '0', `FUNvc255Description` varchar(255) error on collate latin1_general_ci NOT NULL default '', `FUNTCOlFunctionAccessKey` int(11) NOT NULL default '0', `FUNvc50Group1` varchar(50) collate latin1_general_ci default NULL, `FUNvc50Group2` varchar(50) collate latin1_general_ci default NULL, PRIMARY KEY (`FUNlFunctionKey`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci yet when I try to ALTER TABLE FUN_Function ENGINE=InnoDB the result is: ERROR 1025 (HY000): Error on rename of './TXCAD/#sql-5912_86' to './TXCAD/FUN_Function' (errno: 150) and SHOW INNODB STATUS yields: LATEST FOREIGN KEY ERROR ------------------------ 060609 error on rename 17:45:48 Error in foreign key constraint of table TXCAD/FUN_Function: 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 to the ones in the referenced table. Constraint: , CONSTRAINT FK_FUN_Function_COD_Code FOREIGN KEY (FUNCODlFunctionAccessKey) REFERENCES COD_Code (CODlCodeKey) This FK reference is left over from before I made changes to the column names, but nothing I do seems to get rid of the CONSTRAINT. Suggestions, please? Navigate:Previous Message•Next Message Options:Reply•Quote Subject Views Written By Posted errno 150 - foreign key problems 55683 Paul Blazek 06/09/2006 03:50PM Re: errno 150 - foreign key problems 22375 Heikki Tuuri 06/12/2006 12:55AM Re: errno 150 - foreign key problems 13018 Paul Blazek 06/12/2006 08:22AM Re: errno 150 - foreign key problems 9315 mandilas 12/07/2006 07:28AM Re: errno 150 - foreign key problems 7787 Heikki Tuuri 06/12/2006 02:07PM Re: errno 150 - foreign key problems 6849 Nestor Martinez Arque 10/07/2008 04:58PM Re: errno 150 - foreign key problems 5734 KimSeong Loh 10/07/2008 05:55PM Sorry, you can't reply to this topic. It has been closed. powered by phorum Content reproduced on this site is the property of the respective copyright h
Hugo. RSS Feed. Baron Schwartz's Blog MySQL's ERROR 1025 explained Tue, Aug 22, 2006 in Databases MySQL issues a 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 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 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