2

运行此查询时出现 #1025 错误。

SQL查询:

ALTER TABLE  `routes` CHANGE  `end_loc`  `end_loc` VARCHAR( 500 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL

MySQL 说:

#1025 - Error on rename of './ridestr/#sql-1f44_26eeb' to './ridestr/routes' (errno: 150) 

这很有趣,因为我在 PHP MyAdmin 中设置了这个查询……我不知道为什么会出现外键错误……我只是想将某些内容从 int 更改为 varchar

任何人都可以帮忙吗?

4

2 回答 2

6

如果routes.end_loc列在外键中使用,则不能更改其数据类型。您需要删除外键,更改父列和子列的数据类型,然后再次添加外键。

有关此错误的详细信息,请运行SHOW ENGINE INNODB STATUS\G然后查看该LATEST FOREIGN KEY ERROR部分。

于 2011-03-17T15:33:01.403 回答
0

但是如果你想将所有表的整个字符集更改为 utf8,这就是我所做的

     1 export the database (all tables) and open by notepad

     2 replace all "latin1" by utf8 and save

     3 then try to restore using mysqlAdministrator but it says wrong

     4 so try restoring again but you have to select ignore errors radio button
     5 it tries to restore some tables 

     6 then you have to restore again until no error message 

我知道这很难,但我相信这对你也有用

于 2015-04-30T17:18:36.800 回答