Mysql Alter Table Drop Column Error Rename
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 #1025 - error on rename of (errno 150) Us Learn more about Stack Overflow the company Business Learn more about hiring
Error 1025 (hy000) Error On Rename Of (errno 152)
developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Mysql Error 1025 Errno 150
the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up What does mysql error 1025
Error 1025 Outlook Mac
(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 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 error code 1025 outlook mac 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 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: al
here for a quick overview of the site Help Center Detailed answers to any questions you might have mysql rename foreign key Meta Discuss the workings and policies of this site About Us Learn how to drop foreign key in mysql more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us alembic drop foreign key Stack Overflow Questions 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 http://stackoverflow.com/questions/160233/what-does-mysql-error-1025-hy000-error-on-rename-of-foo-errorno-150-me you, helping each other. Join them; it only takes a minute: Sign up #1025 - Error on rename of './database/#sql-2e0f_1254ba7' to './database/table' (errno: 150) up vote 59 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 http://stackoverflow.com/questions/4080611/1025-error-on-rename-of-database-sql-2e0f-1254ba7-to-database-table this: PRIMARY KEY (user_id, round_number) Where user_id is a foreign key. I am 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 199k37360417 asked Nov 2 '10 at 17:55 Richard Knop 23.6k95284462 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 104 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 r
Connectors More MySQL.com Downloads Developer Zone Section Menu: Documentation Home MySQL 5.6 Reference Manual Preface and Legal Notices General Information Installing and Upgrading MySQL Tutorial MySQL Programs MySQL Server Administration https://dev.mysql.com/doc/refman/5.6/en/alter-table.html Security Backup and Recovery Optimization Language Structure Globalization Data Types Functions and Operators SQL Statement Syntax Data Definition Statements ALTER DATABASE Syntax ALTER EVENT Syntax ALTER FUNCTION Syntax ALTER LOGFILE GROUP Syntax ALTER PROCEDURE Syntax ALTER SERVER Syntax ALTER TABLE Syntax ALTER TABLE Partition Operations ALTER TABLE Online Operations in MySQL Cluster ALTER TABLE Examples ALTER TABLESPACE Syntax ALTER VIEW Syntax CREATE error 1025 DATABASE Syntax CREATE EVENT Syntax CREATE FUNCTION Syntax CREATE INDEX Syntax CREATE LOGFILE GROUP Syntax CREATE PROCEDURE and CREATE FUNCTION Syntax CREATE SERVER Syntax CREATE TABLE Syntax CREATE TABLE ... LIKE Syntax CREATE TABLE ... SELECT Syntax Using FOREIGN KEY Constraints Silent Column Specification Changes CREATE TABLESPACE Syntax CREATE TRIGGER Syntax CREATE VIEW Syntax DROP DATABASE Syntax DROP EVENT Syntax DROP error on rename FUNCTION Syntax DROP INDEX Syntax DROP LOGFILE GROUP Syntax DROP PROCEDURE and DROP FUNCTION Syntax DROP SERVER Syntax DROP TABLE Syntax DROP TABLESPACE Syntax DROP TRIGGER Syntax DROP VIEW Syntax RENAME TABLE Syntax TRUNCATE TABLE Syntax Data Manipulation Statements CALL Syntax DELETE Syntax DO Syntax HANDLER Syntax INSERT Syntax INSERT ... SELECT Syntax INSERT DELAYED Syntax INSERT ... ON DUPLICATE KEY UPDATE Syntax LOAD DATA INFILE Syntax LOAD XML Syntax REPLACE Syntax SELECT Syntax SELECT ... INTO Syntax JOIN Syntax UNION Syntax Subquery Syntax The Subquery as Scalar Operand Comparisons Using Subqueries Subqueries with ANY, IN, or SOME Subqueries with ALL Row Subqueries Subqueries with EXISTS or NOT EXISTS Correlated Subqueries Subqueries in the FROM Clause Subquery Errors Optimizing Subqueries Rewriting Subqueries as Joins UPDATE Syntax Transactional and Locking Statements START TRANSACTION, COMMIT, and ROLLBACK Syntax Statements That Cannot Be Rolled Back Statements That Cause an Implicit Commit SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Syntax LOCK TABLES and UNLOCK TABLES Syntax Interaction of Table Locking and Transactions LOCK TABLES and Triggers Table-Locking Restrictions and Conditions SET TRANSACTION Syntax XA Transactions XA Tran