Can I set AUTO_INCREMENT and Primary Key on a column?

Hi is there a way to specify a column in a table as a Primary Key and to set it to AUTO_INCREMENT?

Hello Frank,

I wanted to let you know that you can use one of the options to run your own ALTER TABLE mySQL statements to alter the table to add a Primary Key and AUTO-INCREMENT. This can be done using the button in the top right corner of the database tab or by right clicking the table name and selecting the Query or Alter Table options and changing the tab in the pop up window to allow you to modify the statements directly:

image

You can find some example mySQL statements here:

https://dev.mysql.com/doc/refman/8.0/en/example-auto-increment.html

and here:

https://dev.mysql.com/doc/refman/8.0/en/alter-table-examples.html

Alternatively, for AUTO_INCREMENT you can use the Alter Table interface and under the ‘default’ column change the default value to AUTO_INCREMENT:

Could you please try one of the above solutions and see if they will work for you?

Thanks,

Kaylee Law
Technical Support Specialist
Profound Logic Software

Thanks I used the code area to set the primary key and then set the auto_increment as the default and that worked.

1 Like