After the MySQL database creates a table, in order to have a unique ID to identify a certain record, this ID can be set as the primary key and auto-increment, so that when inserting When a new record is added, it will be automatically incremented with the previous ID. You can set the primary key and auto-increment for the table through SQL, or you can use the tool navicat to set the primary key and auto-increment graphically.
Recommended tutorial: MySQL database introductory video tutorial
## 1. Open the navicat tool, connect to the mysql server, and select After completing the database, select a table and right-click to select the design table (for demonstration and testing here, just select any table) ## 5. After the primary key is set, it has not been incremented yet. After selecting the id field, as shown in the figure below, check Auto-increment, so that the id will increment by a value every time a record is inserted
The above is the detailed content of How to set the primary key to auto-increment in Navicat. For more information, please follow other related articles on the PHP Chinese website!