Mysql
 sql >> Database >  >> RDS >> Mysql

MySQL - Errore di immissione duplicato durante il tentativo di aggiungere una nuova colonna

la soluzione bloccherà la tabella in scrittura, ma spesso è adatta a risolvere il problema se la tabella non è molto grande

LOCK TABLES my_table WRITE;

ALTER TABLE my_table 
ADD COLUMN `ts` DATETIME NULL AFTER `id`;

UNLOCK TABLES;