1025 Error On Rename Of Drop Index
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 hiring developers or posting
Mysql 1025 Error On Rename
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the error 1025 (hy000): error on rename of 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
Error 1025 (hy000) Error On Rename Of (errno 152)
minute: Sign up MySQL Error when dropping index (errno 150) up vote 7 down vote favorite 1 I've got problem with dropping foreign key index, I always get the same error ALTER TABLE `comments` DROP INDEX `id_user` which outputs 1025 - error 1025 (hy000) error on rename of (errno 150) Error on rename of './postuj_cz1/#sql-d834_a0c704' to './postuj_cz1/comments' (errno: 150) The id_user on the other table is simple primary key index. I'm using MySQL version 5.0.85 mysql sql mysql-error-1025 share|improve this question edited Apr 30 '11 at 17:30 OMG Ponies 198k36356415 asked Sep 20 '09 at 13:43 Jakub Arnold 32.1k62178261 1 Try dropping all foreign keys to the table first. –David Andres Sep 20 '09 at 13:47 Actually I don't have any fk to the table –Jakub Arnold Sep 20 '09 general error 1025 error on rename of laravel at 13:58 add a comment| 4 Answers 4 active oldest votes up vote 2 down vote accepted According to this link, the error relates to the definition of the primary key field. The error isn't about the foreign key index. Check the primary key for the COMMENTS table to make sure it does not have the UNSIGNED keyword while the COMMENTS.id_user foreign key had the UNSIGNED keyword. This keyword was causing the problem - inconsistent type of field. To fix, add the UNSIGNED keyword to the primary key definition for the COMMENTS table. Or remove the UNSIGNED keyword from the foreign key definition... share|improve this answer answered Sep 20 '09 at 16:28 OMG Ponies 198k36356415 add a comment| up vote 11 down vote There are other causes too. For example I had a unique index involving two separate foreign key columns. I had to drop the foreign keys in question before I could drop the unique index. (And obviously you can add the foreign keys back afterward.) share|improve this answer answered Jan 24 '11 at 8:50 Willie Wheeler 15.4k66381 1 Thanks, that was the problem in my case. –nightcoder Aug 13 '11 at 23:45 add a comment| up vote 4 down vote INNODB : this could be as simple as removing the Relation before dropping the Index. share|improve this answer answered Aug 28 '12 at 19:27 sglessard 1,63711422 The relation was, for my case, locking everything. So, removing relations, next removing
Local Community Meetups Laravel.io Site and Community mysql error 1025 errno 150 Forum Database migrate:reset erring when dropping foreign key I'm having an
Error 1025 Outlook Mac
issue when rolling back a migration that drops foreign keys. I'm creating the foreign keys in their own migration http://stackoverflow.com/questions/1451042/mysql-error-when-dropping-index-errno-150 file to avoid any issues with the tables not being present and the migration itself works fine. However, the reset provides the following SQL error. [Illuminate\Database\QueryException] SQLSTATE[HY000]: General error: 1025 Error on rename of http://laravel.io/forum/03-22-2014-migratereset-erring-when-dropping-foreign-key data-cfemail="eccbc2c398859c9facdcdcde888d9c85">[emailprotected]/authors_books' to [emailprotected]/#sql2 20a-f4' (errno: 152) (SQL: alter table `authors_books` drop foreign key author_id) Everything seems fine. I'll include a sample migration set that I'm using to isolate the problem. I'm kind of stumped though. Could anyone offer some insight? 2014_03_22_162022_create_table_authors.php bigIncrements('id'); $table->string('name'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('authors'); } } 2014_03_22_162026_create_table_books.php
Start 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 hiring developers or http://serverfault.com/questions/300152/cannot-drop-index-from-mysql-innodb-table-with-foreign-keys-references posting ads with us Server Fault Questions Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody http://symfony-world.blogspot.com/2010/10/mysql-error-on-rename-when-dropping.html can ask a question Anybody can answer The best answers are voted up and rise to the top Cannot drop index from MySQL INNODB table with foreign keys/references up vote -1 down vote favorite I'm about to drop an index from error on a mySQL INNODB table. There are references defined already. When I try to alter it, it says: #1025 - Error on rename of 'X/#sql-2a5f_219828' to 'X' (errno: 150) Which at first seems logical, since there are relations, it can't be renamed. But even if I disable foreign key checking: SET foreign_key_checks = 0; ALTER TABLE flyers DROP INDEX Index_5, ROW_FORMAT = DYNAMIC; I get the same! I don't want to drop ALL foreign key definitions, drop that index, and define them again! Another error on rename solution? mysql innodb foreign-key share|improve this question edited Jan 25 at 6:16 Jenny D 18.6k54374 asked Aug 11 '11 at 15:55 deeped 11 stackoverflow.com/questions/160233/… –quanta Aug 11 '11 at 16:04 add a comment| 2 Answers 2 active oldest votes up vote 0 down vote Create a new index before dropping the old one. share|improve this answer answered Aug 11 '11 at 16:12 snap 987714 what has a new index has to do with the old one? –deeped Aug 11 '11 at 22:50 My answer may be incorrect if it does not help for you. I recently faced a situation where I had a foreign key referring to a column in another table and wanted to change/re-create the index for that column. I was not able to get rid of the old index, but after I first created a new index (basically a duplicate of the original index) I was able to drop the old one. Maybe the error message was different though and this is not related... Sorry about the noise. –snap Aug 11 '11 at 23:51 add a comment| up vote 0 down vote the problem was there was already an index on the foreign key field :) and I didnt know that foreign key is also an index. Anyway I ripped all my hair out in the end, I had to drop all indexes to get rid of it. I will never use innoDB again share|improve th
Recently I wanted to remove a column from phpmyadmin that is covered with a constraint. Impossible to do so, MySQL throws following error: ERROR 1025 (HY000): Error on rename of './optiner_prestadmin/#sql-6bc_3e6' to './optiner_prestadmin/order_history' (errno: 150) You may get above error when executing a query removing index, e.g. ALTER TABLE order_history DROP INDEX user_id;Fortunately, there is a solution, not very easy to find in the internet (I used comments from this article). execute the following in MySQL: SHOW CREATE TABLE order_history;You shall get something like: order_history | CREATE TABLE `order_history` ( `order_id` bigint(20) NOT NULL, `user_id` bigint(20) NOT NULL, `status_id` bigint(20) NOT NULL, `informed` tinyint(1) DEFAULT '0', `comment` text, `created_at` datetime NOT NULL, `created_by` bigint(20) NOT NULL DEFAULT '1', PRIMARY KEY (`id`), KEY `order_id_idx` (`order_id`), KEY `user_id_idx` (`user_id`), KEY `status_id_idx` (`status_id`), KEY `created_by_idx` (`created_by`), CONSTRAINT `order_history_created_by_sf_guard_user_id` FOREIGN KEY (`created_by`) REFERENCES `sf_guard_user` (`id`) ON DELETE CASCADE, CONSTRAINT `order_history_order_id_order_info_id` FOREIGN KEY (`order_id`) REFERENCES `order_info` (`id`), CONSTRAINT `order_history_status_id_order_status_id` FOREIGN KEY (`status_id`) REFERENCES `order_status` (`id`), CONSTRAINT `order_history_user_id_sf_guard_user_id` FOREIGN KEY (`user_id`) REFERENCES `sf_guard_user` (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=28305 DEFAULT CHARSET=utf8 we want to delete the whole column user_id (with all corresponding indices, constraints, etc.) - need to drop the FOREIGN KEY first: ALTER TABLE order_history DROP FOREIGN KEY `order_history_user_id_sf_guard_user_id`;you'll find the name of the foreign key in the last constraint clause. finally, drop the column: ALTER TABLE `order_history` DROP `user_id`;and that's it! Query OK, 28065 rows affected (3,99 sec) Records: 28065 Duplicates: 0 Warnings: 0 Auto