Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

mysql-error-1025

Renaming foreign-key columns in MySQL

May 7, 2023 by Tarik

AFAIK, dropping the constraint, then rename, then add the constraint back is the only way. Backup first!

Categories sql Tags foreign-keys, mysql, mysql-error-1025, sql Leave a comment

#1025 – Error on rename of ‘./database/#sql-2e0f_1254ba7’ to ‘./database/table’ (errno: 150)

January 30, 2023 by Tarik

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.

Categories mysql Tags innodb, mysql, mysql-error-1025, phpmyadmin, sql Leave a comment

What does mysql error 1025 (HY000): Error on rename of ‘./foo’ (errorno: 150) mean?

November 14, 2022 by Tarik

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 … Read more

Categories mysql Tags mysql, mysql-error-1025 Leave a comment

MySQL Removing Some Foreign keys

October 12, 2022 by Tarik

As explained here, seems the foreign key constraint has to be dropped by constraint name and not the index name. The syntax is: ALTER TABLE footable DROP FOREIGN KEY fooconstraint;

Categories mysql Tags constraints, foreign-keys, mysql, mysql-error-1025 Leave a comment

Error renaming a column in MySQL

September 17, 2022 by Tarik

Lone Ranger is very close… in fact, you also need to specify the datatype of the renamed column. For example: ALTER TABLE `xyz` CHANGE `manufacurerid` `manufacturerid` INT; Remember : Replace INT with whatever your column data type is (REQUIRED) Tilde/ Backtick (`) is optional

Categories mysql Tags alter-table, database, mysql, mysql-error-1025 Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa