Error 150 Mysql 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 Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with
Mysql Error On Rename Of Errno 150
us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow mysql error on rename of errno 152 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 error 150 mysql can't create table Mysql error 150 on column rename up vote 5 down vote favorite I've an old db with columns'charset to latin1 Now i'm trying to change the whole db in utf8, i've made a script to change all the tables in utf8 like
Mysql Error 1025
this: ALTER TABLE `mytable` CHARACTER SET utf8; and all the columns like this: ALTER TABLE `mytable` CHANGE `mycolumn` `mycolumn` varchar(200) CHARACTER SET utf8; But on some columns (primary keys and constraints, i guess) i'm getting this error: Error on rename of './test/#sql-5028_217b96' to './test/mytable' (errno: 150) Anyone knows how to get around this? mysql character-encoding alter-table share|improve this question edited Oct 1 '12 at 13:51 Maksym Polshcha 8,59342951 asked Oct 1 '12 at 12:50 Cirou 957514 add a comment| 1 Answer 1 active oldest votes
Error 1025 (hy000) Error On Rename Of (errno 150)
up vote 8 down vote accepted The most likely your mycolumn is a part of a foreign key. If so, you have to remove the constraint, then change type for the both primary/foreign key and then add constraint again. share|improve this answer answered Oct 1 '12 at 12:56 Maksym Polshcha 8,59342951 I just ran into a similar problem (going from an INT to a BIGINT). I decided to duplicate the table (which had a foreign key constraint on the column I needed to change) and its content, change the column type in the duplicate table without issue, and then replaced the original table with the duplicate table. Is that a dangerous thing to do? –tylerl Jun 11 '14 at 19:31 @tylerl No, if the data on the original table remains unchanged during your changes. Otherwise you can have data loss/inconsistency. –Maksym Polshcha Jun 12 '14 at 8:02 Yeah I believe it broke things in my app... Something must have not copied over right when the table was duplicated (I'm using Sequel Pro on a Mac)? I don't think any data was lost, but suddenly my server didn't feel like saving data to a particular table anymore! Weird... The problem is that I had made a note that the field in question was a foreign key in a particular table, but I can't find the FK constraint! Grrrr.... –tylerl Jun 12 '14 at 18:44 Anybody knows of any tool that is able to
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss http://dba.stackexchange.com/questions/86853/1025-error-on-rename-of-table-errno-150-table-was-deleted-while-tried-to-a the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn error 1025 from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top #1025 - Error on rename of table errno: 150 : Table was deleted while tried to assign foreign key up vote 1 down error on rename vote favorite When I tried to assign foreign key to a table named mydb.table1 it was deleted from my database, I could not understand the reason and tried to move on. For this tried to create same table with create SQL but it says #1005 - Can't create table 'mydb.table1' (errno: 150) Now I created same schema table with table name table2, this was successfully created but as my application code is written for table1, I need to rename this table to table1 again on which gives me following error. #1025 - Error on rename of table errno: 150 Also tried to run alter table query with set foreign_key_checks = 0. But same error. While searching I came accross below SQL, SHOW INNODB ENGINE STATUS; Which displays following message 141223 11:30:10 Error in foreign key constraint of table myahd/table1: 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 the ones in the referenced table or one of the ON