<p>I assume you're referring to the auto incrementing primary key values in the tables.  Craft doesn't manage that at all, but relies on MySQL to do so.</p>

<p>See <a href="https://stackoverflow.com/questions/8923114/how-to-reset-auto-increment-in-mysql">here</a> for discussion on how to do it, just keep in mind that there's a pretty high chance you'll be breaking foreign key constraints on existing data.  And I'm pretty sure you'll need to truncate the table first before running the command you tried.</p>

<blockquote>
  <p>I've also noticed that there is no auto_increment setting in the table structures.</p>
</blockquote>

<p>Sure it does. Check the primary key of any table and you'll see the auto increment bit.</p>

CC BY-SA 3.0
2015-05-21T19:28:01.870Z
2015-05-21T19:28:01.870Z
Brad Bell
<p>How does craft manage the counts? And how do I set it to a specific number? </p>

<p>I've already tried to do it manually with something along the lines of </p>

<p><code>ALTER TABLE tablename AUTO_INCREMENT = 1</code></p>

<p>But that doesn't really do the trick. </p>

<p>I've also noticed that there is no auto_increment setting in the table structures. Can someone please point me in the right direction?</p>

<p>Thanks!</p>

CC BY-SA 3.0
2015-05-21T18:12:55.900Z
Hey Backslash, would you tell us why you want to reset the counter?
carlcs
CC BY-SA 3.0
2015-05-21T18:31:41.653Z
I know it's bad for practice. Mainly it's because of version control systems. Somewhere down the road something got messed up. We would like to reset them before pushing it live. Otherwise we would have to do a reset. Which could cost us s couple of hours.
Backslash
CC BY-SA 3.0
2015-05-21T21:36:28.077Z
I would highly recommend **not** doing this. As Brad mentioned in his answer, there's a pretty good chance you're going to break something. In all likelihood, you'll be causing more problems than you solve.
Lindsey D
<database>
Reset db "auto_increment" count?
# Reset db "auto_increment" count?

(Asked by: username_0 on 2015-05-21)

How does craft manage the counts? And how do I set it to a specific number?

I've already tried to do it manually with something along the lines of

`ALTER TABLE tablename AUTO_INCREMENT = 1`

But that doesn't really do the trick.

I've also noticed that there is no auto\_increment setting in the table structures. Can someone please point me in the right direction?

Thanks!

**Tags:** database
> **Comments:**
> **username_1**: Hey Backslash, would you tell us why you want to reset the counter?  
> **username_0**: I know it's bad for practice. Mainly it's because of version control systems. Somewhere down the road something got messed up. We would like to reset them before pushing it live. Otherwise we would have to do a reset. Which could cost us s couple of hours.  
> **username_2**: I would highly recommend **not** doing this. As Brad mentioned in his answer, there's a pretty good chance you're going to break something. In all likelihood, you'll be causing more problems than you solve.  

---

## 1 answers

### Answer by username_3 on 2015-05-21. Score: 2

I assume you're referring to the auto incrementing primary key values in the tables. Craft doesn't manage that at all, but relies on MySQL to do so.

See [here](https://stackoverflow.com/questions/8923114/how-to-reset-auto-increment-in-mysql) for discussion on how to do it, just keep in mind that there's a pretty high chance you'll be breaking foreign key constraints on existing data. And I'm pretty sure you'll need to truncate the table first before running the command you tried.

> I've also noticed that there is no auto\_increment setting in the table structures.

Sure it does. Check the primary key of any table and you'll see the auto increment bit.


---

