Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6147715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:09:08+00:00 2026-05-23T19:09:08+00:00

I have a table with the following primary key: PRIMARY KEY (`Id`,`InputOutputConfigurationServerAccountId`,`Identifier`) I want

  • 0

I have a table with the following primary key:

PRIMARY KEY (`Id`,`InputOutputConfigurationServerAccountId`,`Identifier`)

I want to modify this so that the PK is only the Id column. How do I do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:09:08+00:00Added an answer on May 23, 2026 at 7:09 pm

    The problem seems to be that you have Id defined as auto_increment. You need to first change it to just plain int, them make the changes, then turn it back to auto_increment.
    Try this:

    ALTER TABLE SO1 MODIFY COLUMN ID INT;
    ALTER TABLE SO1 DROP PRIMARY KEY;
    ALTER TABLE SO1 ADD PRIMARY KEY (id);
    ALTER TABLE SO1 MODIFY COLUMN ID INT AUTO_INCREMENT;
    

    Here’s a test of the above (btw, I got the error you mentioned in your comment on other answer if I didn’t first modify the column):

    drop table if exists SO1;
    create table SO1 (
      id int auto_increment,
      InputOutputConfigurationServerAccountId int,
      Identifier int,
      PRIMARY KEY (`Id`,`InputOutputConfigurationServerAccountId`,`Identifier`)
    );
    ALTER TABLE SO1 MODIFY COLUMN ID INT;
    ALTER TABLE SO1 DROP PRIMARY KEY;
    ALTER TABLE SO1 ADD PRIMARY KEY (id);
    ALTER TABLE SO1 MODIFY COLUMN ID INT AUTO_INCREMENT;
    show create table SO1;
    

    All executed OK. Final Output:

    CREATE TABLE `SO1` (
      `ID` int(11) NOT NULL AUTO_INCREMENT,
      `InputOutputConfigurationServerAccountId` int(11) NOT NULL DEFAULT '0',
      `Identifier` int(11) NOT NULL DEFAULT '0',
      PRIMARY KEY (`ID`)
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following table: T(ID primary key, A, B) I want to have
I have the following tables: create table TableA ( Id int primary key identity,
I have the following pseudo-SQL schema: table flight id int primary key date timestamp
I have the following defining a table: CREATE TABLE players(playerid INTEGER PRIMARY KEY AUTOINCREMENT
In a MySQL database I have a table with the following primary key PRIMARY
I have a table with following structure : id, - Primary key minlatitude -
I have the following table: CREATE TABLE child( id INTEGER PRIMARY KEY, parent_id INTEGER,
I have the following table: CREATE TABLE child( id INTEGER PRIMARY KEY, parent_id INTEGER
I have a messages table with the following columns: id (primary Key) username timestamp
I have table structures that include a composite primary key of id & revision

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.