#1025 - Error On Rename Of Errno 152
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
Mysql Error 1025 Errno 152
Us Learn more about Stack Overflow the company Business Learn more about hiring error on rename errno 150 developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the
#1025 - Error On Rename Of (errno 150)
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 unable to drop the foreign key error 1025 (hy000) error on rename of (errno 152) up vote 15 down vote favorite 2 I would like to drop the foreign key in my table but been into this error message mysql> alter table customers drop foreign key customerid; ERROR 1025 (HY000): Error on rename of '.\products\customers' to '.\products\#sql2-7ec-a3' (errno: 152) mysql> mysql foreign-keys foreign-key-relationship mysql-error-1025 share|improve this question edited May 17 '12 at 9:18 Fahim Parkar 15.7k2294193 asked May 17 '12 at general error 1025 error on rename of laravel 8:57 solomon 1171210 1 This may help you to understand stackoverflow.com/questions/160233/… –Imdad May 17 '12 at 9:04 @Imdad This link describes another error - (errno: 150) –Devart May 17 '12 at 9:17 Try this. Create new table (without foreign key constraint). copy the data to new table (using syntax INSERT INTO new_table SELECT * FROM old_table) Drop the old table –Imdad May 17 '12 at 9:22 Have you checked @Maksym Polshcha's answer? You have to use the foreign key's name not the column name. (it might be something like fk_customerid) –Imdad May 17 '12 at 9:24 check my answer and let me know if you still have problem... –Fahim Parkar May 17 '12 at 9:37 | show 1 more comment 4 Answers 4 active oldest votes up vote 4 down vote accepted To avoid getting this error while trying to drop a foreign key, use the constraint name rather than the column name of the foreign key. When I tried mysql> ALTER TABLE mytable DROP PRIMARY KEY; I got error as ERROR 1025 (HY000): Error on rename of '.\database\#sql-454_3' to '.\database\mytable' (errno: 150). I solved it
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies
Mysql Error 1025 Errno 150
of this site About Us Learn more about Stack Overflow the company laravel migration drop foreign key Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges
Error 1025 Outlook Mac
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 minute: http://stackoverflow.com/questions/10632587/unable-to-drop-the-foreign-key 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 Dec http://stackoverflow.com/questions/160233/what-does-mysql-error-1025-hy000-error-on-rename-of-foo-errorno-150-me 5 '09 at 7:00 OMG Ponies 198k36356415 asked Oct 1 '08 at 23:33 Trenton 3,52563238 @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 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 th
4:36 Reporter: Disha Email Updates: Status: Verified Impact on me: None Category:MySQL Server: InnoDB storage engine Severity:S4 (Feature https://bugs.mysql.com/bug.php?id=10333 request) Version:5.0.7 OS:Linux (Linux) Assigned to: Assigned Account Triage: Triaged: D5 (Feature request) View Add Comment Files Developer Edit Submission View Progress Log Contributions [3 May 2005 13:29] Disha Description: When we try to delete a foreign key from a table and if we specify incorrect constraint name, the error displayed is incorrect. How to error on repeat: 1. Start the MySQL client and connect to the database. 2. Set the delimiter to //. 3. Run the following commands to create and use a database. drop database if exists db1// create database db1// use db1// 4. Now using the following commands create two tables where the second table has a foreign error on rename key reference to the first table as follows: drop table if exists course// create table course ( id int, courcename char(100) not null, duration int not null, primary key (id) ) engine=innodb// insert into course values(1,'system design',4), (2,'database system',6), (3,'operating system',16)// drop table if exists students// create table students ( id int not null, name char(100) not null, course_id int, foreign key (course_id) references course(id) on delete set null ) engine=innodb// insert into students values(1,'l',1), (2,'m',1), (3,'n',2),(4,'o',3),(5,'p',3),(6,'q',1)// 5. Now try to delete the foreign key with incorrect constraint name as follows: alter table students drop foreign key id// Expected Results: 1. Appropriate error should be displayed as the constraint name supplied does not exist. Actual Results: 1. Incorrect error is displayed as: "ERROR 1025 (HY000): Error on rename of '.\db1\students' to '.\db1\#sql2-1b0-57' (errno: 152)" [3 May 2005 14:05] Miguel Solorzano mysql> alter table students drop foreign key id// ERROR 1025 (HY000): Error on rename of '.\db1\students' to '.\db1\#sql2-45c-1' (errno: 152) mysql> sele