DevChunks

Reseed MySQL Primary Key – AUTO_INCREMENT

If you want to reseed your primary key (i.e. change the value of the next primary key generated), you can do it like this:

ALTER TABLE table_name AUTO_INCREMENT = 59446;

This is useful for starting a new site, and you don’t want to leave hints that you have just launched.

For example, if you sign up a new user whose user_id is 3 and they can see it (e.g. in the URL), then they can easily figure out you are new.

This is increasingly important for eCommerce, where customer confidence is essential. Re-seed your invoice/order numbers if they are based on primary keys, and it will look like you have been in business for years.

Share:

2 Responses

  1. Yeh, but the most of the readers are using phpMyAdmin.. and they could just click “Operations” -tab .. and set the AUTO_INCREMENT -value.

Leave a Reply

Your email address will not be published.

More Posts

How to use PHP Type Declarations

PHP has developed into a more strictly typed language in recent years. Type Declarations help with that and are a fairly new addition to PHP,

Iteration

If you have come to JavaScript from a background in Java or C, then you will like the variation on the for loop. It is

Context Object Manipulation

One of the key concepts of JavaScript is the keyword this, which signifies the JavaScript context object. If you write an inner function, you can access

Polymorphic Functions

It is possible to define multiple functions with the same name in JavaScript, and the last one of those that you define will be the