将自动递增和唯一性添加到 Table ID 失败

Adding Auto Increment and Unique to Table ID Failing

我正在使用 mysql workbench 来改变 table,我以前从未遇到过这个问题。我正在尝试更改我的 table 以拥有一个自动递增的唯一 table ID。我从错误屏幕中得到以下信息:

Operation failed: There was an error while applying the SQL script to the database.
Executing:
ALTER TABLE `madewix5_lindsey_website_data`.`products` 
CHANGE COLUMN `product_id` `product_id` INT(3) NOT NULL AUTO_INCREMENT ,
ADD UNIQUE INDEX `product_id_UNIQUE` (`product_id` ASC) VISIBLE;
;

ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 3
SQL Statement:
ALTER TABLE `madewix5_lindsey_website_data`.`products` 
CHANGE COLUMN `product_id` `product_id` INT(3) NOT NULL AUTO_INCREMENT ,
ADD UNIQUE INDEX `product_id_UNIQUE` (`product_id` ASC) VISIBLE

我觉得语法不错,所以我不确定为什么它说有问题。 table.

中有一行数据

编辑 根据 mysql --version,我的 xampp 服务器当前使用的是版本 Ver 15.1 Distrib 10.1.36-MariaDB, for Win32 (AMD64),因此评论中建议的副本可能不适用。

根据评论中的帮助,已经给出了其他答案的建议,但要澄清的是,在使用 Maria-DB 软件更新的 XAMPP 服务器的具体情况下,目前可能不支持单词 "visible"。删除工作 "visible" 允许脚本 运行 并将唯一和自动递增属性添加到主键。

ALTER TABLE `madewix5_lindsey_website_data`.`products` 
CHANGE COLUMN `product_id` `product_id` INT(3) NOT NULL AUTO_INCREMENT ,
ADD UNIQUE INDEX `product_id_UNIQUE` (`product_id` ASC);