为什么我收到此错误:“SQL 错误 1025:重命名“...”时出错到“...” (错误号:150)”?

发布于 2024-09-29 11:04:47 字数 218 浏览 0 评论 0原文

我想在 MySQL 版本 5.2.25 中从“alter table”重命名表的字段,但出现此错误:

SQL Error 1025: Error on rename of '.\Packers\#sql-804_3' to '.\Packers\pattern' (errno: 150)

但在其他表上我没有这个问题,我不知道为什么,是由外国引起的钥匙?

I want to rename a field of a table in MySQL ver 5.2.25, from "alter table", but I got this error:

SQL Error 1025: Error on rename of '.\Packers\#sql-804_3' to '.\Packers\pattern' (errno: 150)

but on other table I had not this problem, I don't know why, is it caused by foreign key?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笑忘罢 2024-10-06 11:04:47

是的,这是一个外键错误。在尝试alter table后立即show innodb status,部分输出将是最后一个外键错误详细信息。

一般来说,它是由外键字段上的数据类型不匹配引起的(在一个表中是“int”,但在更改表中是“bigint”,或者一个是无符号的,另一个是无符号的,等等......)

Yes, it's a foreign key error. Do show innodb status immediately after your alter table attempt, and part of the output will be the last foreign key error details.

Generally it's caused by a data type mismatch on the foreign key fields (it's 'int' in one table but 'bigint' in your alter table, or one's unsigned and the other's not, etc...)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文