重命名 MySQL 中的列时出错

如何重命名表 xyz 中的列?列是:

How do I rename a column in table xyz? The columns are:

Manufacurerid, name, status, AI, PK, int

我想重命名为manufacturerid

我尝试使用 PHPMyAdmin 面板,但出现此错误:

I tried using PHPMyAdmin panel, but I get this error:

MySQL said: Documentation
#1025 - Error on rename of '.\shopping\#sql-c98_26' to '.\shopping\tblmanufacturer' (errno: 150)

推荐答案

Lone Ranger 非常接近...其实你还需要指定重命名列的数据类型.例如:

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;

记住:

  • 将 INT 替换为您的任何列数据类型(必需)
  • 波浪号/反引号 (`) 是可选的

相关文章