For me, none of suggestions worked giving me the errors of syntax, so I just gave a try using phpmyadmin(version 4.9.2), (10.4.10-MariaDB) and added id
column with auto-increment primary key. Id
column was nicely added from the first element.
Query output was:
ALTER TABLE table_name
ADD id
INT NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY (id
);