Setting next AUTOINCREMENT value

Tutorials Shared by the Internet Community

Advertisements


Synopsis

How to set next AUTO-INCREMENT value in MySQL database?

Statistics

  • Total Hits - 27503

  • Total Votes - 110 votes

  • Vote Up - 48 votes

  • Vote Down - 62 votes

  • Domain - axdimensions.wordpress.com

  • Category - MySQL/MySQL Misc

  • Submitted By - Shekhar

  • Submitted on - 2008-04-15 01:20:49

Description

By default, MySQL starts auto-incrementing from value 1. To start with value other than 1, you can set that value with CREATE TABLE or ALTER TABLE, like this:

mysql> ALTER TABLE [tablename] AUTO_INCREMENT = [number];

An alternate way of doing this is, simply insert a row in your Table and enter the next auto-increment value. ...


Site  |   Broken  |   Tweet  |   Facebook  |     |   Save  |   Liked  |   Down

Advertisements