MySQL: #1075 – Incorrect table definition; autoincrement vs another key?

You can have an auto-Incrementing column that is not the PRIMARY KEY, as long as there is an index (key) on it: CREATE TABLE members ( id int(11) UNSIGNED NOT NULL AUTO_INCREMENT, memberid VARCHAR( 30 ) NOT NULL , `time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , firstname VARCHAR( 50 ) NULL , lastname VARCHAR( 50 … Read more

Remove Primary Key in MySQL

Without an index, maintaining an autoincrement column becomes too expensive, that’s why MySQL requires an autoincrement column to be a leftmost part of an index. You should remove the autoincrement property before dropping the key: ALTER TABLE user_customer_permission MODIFY id INT NOT NULL; ALTER TABLE user_customer_permission DROP PRIMARY KEY; Note that you have a composite … Read more

tech