2

我有这张表是从旧版本的 mysql 迁移而来的:

> SHOW COLUMNS from tbl
(output modified below for posting)

watch_id           | int(11)      | NO   | PRI | NULL  
user_id            | varchar(125) | YES  | MUL | NULL
type               | int(11)      | YES  | MUL | NULL
range              | int(10)      | YES  |     | NULL
active             | tinyint(4)   | NO   |     | 1

“范围”是当前版本中的保留字

ALTER TABLE `db`.`tbl` CHANGE COLUMN `range` `watch_range` INT(10) DEFAULT NULL;

结果是

ERROR 1054 (42S22): Unknown column 'range' in 'tbl'

有任何想法吗?

注意:当我最初发布此内容时,我打错了,sql 有:

`range` not `range' as I originally posted
4

1 回答 1

1

正如@eggyal 建议的那样

ran mysql_upgrade
ran repair

然后

dumped the database and removed it
imported the dump
restarted mysql

工作,不知道为什么

于 2012-07-03T20:55:37.667 回答