我有这张表是从旧版本的 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
“range”在当前版本中是保留字
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
最佳答案
正如@eggyal建议的那样
ran mysql_upgrade
ran repair
然后
dumped the database and removed it
imported the dump
restarted mysql
成功了,不知道为什么
关于mysql - 迁移数据库到当前版本的MySQL,一个表中有一个保留字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11318540/