LMSouq
database Open

Remove Primary Key in MySQL

MA
markb
1 month ago
3 views
Problem Description
I have the following table schema which maps user_customers to permissions on a live MySQL database: mysql> describe user_customer_permission; +------------------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+---------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | user_customer_id | int(11) | NO | PRI | NULL | | | permission_id | int(11) | NO | PRI | NULL | | +------------------+---------+------+-----+---------+----------------+ 3 rows in set (0.00 sec) I would like to remove the primary keys for user_customer_id and permission_id and retain the primary key for id. When I run the command: alter table user_customer_permission drop primary key; I get the following error: ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key How can I drop a column's primary key?

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base