#1025 - Error On Rename Of Mysql
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and #1025 - error on rename of (errno 150) mysql policies of this site About Us Learn more about Stack Overflow the mysql error on rename of errno 150 company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags
#1025 - Error On Rename Of (errno 150)
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 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 error code 1025 in mysql 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,4401365131
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and
Error Code 1025. Error On Rename Of
policies of this site About Us Learn more about Stack Overflow the company general error 1025 error on rename of Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users error on rename of '#sql' to ' errno 150 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 #1025 - Error on rename (errno: 150) in mysql up vote 8 down vote favorite 1 I am trying to drop a foreign key(id) in one table(misc) which is the primary key(id) in table(main). db name(xxx) alter table misc drop FOREIGN KEY id I am getting this error #1025 - Error on rename of '.\interview#sql-edc_27' to '.\interview\misc' (errno: http://stackoverflow.com/questions/19668682/1025-error-on-rename-errno-150-in-mysql 150) mysql share|improve this question edited Oct 29 '13 at 20:43 juergen d 125k21130196 asked Oct 29 '13 at 20:42 black 68931124 possible duplicate of #1025 - Error on rename of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150) –Kermit Oct 29 '13 at 20:50 add a comment| 2 Answers 2 active oldest votes up vote 14 down vote accepted SHOW CREATE TABLE misc ; You can't drop the foreign key using the column name,run the above query to find out the correct name,something like misc_ibfk_1 Heh,IT IS this name: alter table misc drop FOREIGN KEY misc_ibfk_1 share|improve this answer answered Oct 29 '13 at 20:50 Mihai 15.2k52442 ALTER TABLE misc DROP COLUMN id to drop column . thanks –black Oct 29 '13 at 21:00 add a comment| up vote 1 down vote In my case, was necessary to make a 3-step process (my table is named "articulos", and the hard-to-remove index is "FK_Departamento_ID") For knowing the name of table, I executed: SHOW INDEX FROM articulos; This statement resolved the issue (#1025, errno: 150), but the index remained in the table AL
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 error on 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 error on rename 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