Migrated database to current version of MySQL, one table has a reserved word in it

StackOverflow https://stackoverflow.com/questions/11318540

  •  18-06-2021
  •  | 
  •  

سؤال

I have this table which was migrated from an older version of 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" is a reserved word in current versions

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

Results in

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

Any ideas?

NOTE: When I originally posted this I made a typo, the sql has:

`range` not `range' as I originally posted
هل كانت مفيدة؟

المحلول

as @eggyal suggested

ran mysql_upgrade
ran repair

then

dumped the database and removed it
imported the dump
restarted mysql

worked, no idea why

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top