# Reset Entry ID to 1 \[RESOLVED\]

**URL:** <https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364>\
**Category:** Get Help\
**Tags:** entry-id, mysql, auto\_increment\
**Created:** [December 7, 2021, 3:09pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364 "2021-12-07T15:09:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![simonc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/simonc/32/1431_2.png) [@simonc](https://community.gravityforms.com/u/simonc)\
**Post date:** [December 7, 2021, 3:09pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/1 "2021-12-07T15:09:05Z")

</div>

(There’s another thread with a similar title, but it’s not relevant.)

My entry IDs have gone above 30k and it’s causing problems elsewhere. How can I reset the autoincrement back to 1? Then I won’t have this problem for another 30.000 entries. 🙂

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [December 7, 2021, 8:43pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/2 "2021-12-07T20:43:35Z")

</div>

What kind of problems is the entry ID over 30K causing for you?

---

<div class="post-metadata">

**Author:** ![simonc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/simonc/32/1431_2.png) [@simonc](https://community.gravityforms.com/u/simonc)\
**Post date:** [December 7, 2021, 8:57pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/3 "2021-12-07T20:57:34Z")

</div>

Oh boy does that mean there’s no simple value I can reset in the db? 🙂

It’s related to 3rd party APIs where we’ve used the entryID as a uniqueID in a handful of different situations. Rather than hunting down and adjusting all those situations it seems easiest to ‘fix’ the problem at the source and start from 1.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [December 7, 2021, 9:03pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/4 "2021-12-07T21:03:13Z")

</div>

If you reset the entry ID back to one, you will need to remove all your existing entries and related entry data. Are you OK with that?

---

<div class="post-metadata">

**Author:** ![simonc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/simonc/32/1431_2.png) [@simonc](https://community.gravityforms.com/u/simonc)\
**Post date:** [December 7, 2021, 9:27pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/5 "2021-12-07T21:27:23Z")

</div>

Yes absolutely. We purge our entries after 24 hours, so we’ve got about 30 entries at the moment, with IDs in the 30.000s. Totally fine to delete.

You’re just saying there can’t ever be duplicate entry IDs. So even if we didn’t purge all entries before resetting, as long as they weren’t close to the current entry IDs we’d be fine?

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [December 7, 2021, 9:30pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/6 "2021-12-07T21:30:21Z")

</div>

Ok, last question, I think. Are all entries for all forms deleted? If so, you will be able to reset the entry ID back to 1. Otherwise, this won’t work, because the entry ID is sequential across all forms.

---

<div class="post-metadata">

**Author:** ![simonc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/simonc/32/1431_2.png) [@simonc](https://community.gravityforms.com/u/simonc)\
**Post date:** [December 7, 2021, 9:31pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/7 "2021-12-07T21:31:44Z")

</div>

Gotcha, appreciate you being so thorough as always Chris!

Yes, we have a handful of forms but all entry IDs are in the 30k range.  
Resetting to zero wouldn’t result in duplicate IDs for some time, and by then the old entries will have been auto purged.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [December 7, 2021, 9:45pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/8 "2021-12-07T21:45:56Z")

</div>

I don’t think this will work if you are going to retain some entries with higher entry IDs. MySQL won’t allow you to set an autoincrement value lower than a record already in the table. So if you have entries there with higher IDs already, you would not be able to do this anyway.

ref: [sql - How to reset AUTO\_INCREMENT in MySQL - Stack Overflow](https://stackoverflow.com/a/8923132)

I would focus on fixing the other end that cannot handle the higher entry IDs.

---

<div class="post-metadata">

**Author:** ![simonc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/simonc/32/1431_2.png) [@simonc](https://community.gravityforms.com/u/simonc)\
**Post date:** [December 7, 2021, 9:56pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/9 "2021-12-07T21:56:32Z")

</div>

Thanks Chris, I’d rather delete the higher entry IDs and start fresh. Thanks!  
What is the table where this is stored for GF?

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [December 7, 2021, 10:17pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/10 "2021-12-07T22:17:34Z")

</div>

Gravity Forms entry-related data is stored in three tables. If your WordPress database prefix is wp\_, these are the tables:

```auto
wp_gf_entry
wp_gf_entry_meta
wp_gf_entry_notes

```

If you have deleted all the entries, you should have no records in any of those tables.

The autoincrement for the entry ID is on the wp\_gf\_entry table. You can find out what that is currently using this SQL:

```auto
SHOW TABLE STATUS LIKE 'wp_gf_entry';

```

That shows a bunch of columns, one of which is `Auto_increment`.

To reset that, first, please make a database backup, in case something goes horribly wrong. This worked for me with my MySQL database installation and version, but your may be different. Please make a database backup first.

To reset the auto\_increment for the wp\_gf\_entry, this is the SQL command to execute:

```auto
ALTER TABLE wp_gf_entry AUTO_INCREMENT = 1;

```

Then run the previous command `SHOW TABLE STATUS LIKE 'wp_gf_entry';` to check to see the new auto\_increment value.

That showed “1” for me, so that worked, and the next entry that will be stored with one of your forms will get the entry ID 1.

Like I mentioned, make a database backup first. We can’t be held responsible for anything which may go wrong here. Let us know how it turns out.

_ **Disclaimer** _ _: Third party plugins or code snippets that are provided or referenced by our Support Team or documentation, are provided as suggestions only. We do not evaluate, test, guarantee or officially support third party solutions or code-snippets. You are wholly responsible for determining if any suggestion or code snippet provided is sufficient to meet the functional, security, legal, ongoing cost and support needs of your project, as well as testing and confirming performance across future product updates._

---

<div class="post-metadata">

**Author:** ![simonc](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/simonc/32/1431_2.png) [@simonc](https://community.gravityforms.com/u/simonc)\
**Post date:** [December 8, 2021, 1:46pm UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/11 "2021-12-08T13:46:40Z")

</div>

Thanks Chris, that worked beautifully.

---

<div class="post-metadata">

**Author:** ![chrishajer](https://sea2.discourse-cdn.com/flex020/user_avatar/community.gravityforms.com/chrishajer/32/88_2.png) [@chrishajer](https://community.gravityforms.com/u/chrishajer)\
**Post date:** [December 9, 2021, 1:58am UTC](https://community.gravityforms.com/t/reset-entry-id-to-1-resolved/11364/12 "2021-12-09T01:58:11Z")

</div>


