{"id":206,"date":"2020-07-31T15:35:32","date_gmt":"2020-07-31T14:35:32","guid":{"rendered":"http:\/\/www.qpcoaching.co.uk\/qedevelopment.co.uk\/?p=206"},"modified":"2020-12-31T12:51:31","modified_gmt":"2020-12-31T12:51:31","slug":"mysql-reset-the-auto_increment-value","status":"publish","type":"post","link":"https:\/\/qedevelopment.co.uk\/?p=206","title":{"rendered":"MySQL: How to Reset the AUTO_INCREMENT Value"},"content":{"rendered":"\n<p>If you are using the auto_increment feature of MySQL and table edits have lead to the value generated being in advance of requirements or just generally adrift you can use the following command to adjust the next auto_increment output value.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ALTER TABLE &lt;table name&gt; AUTO_INCREMENT = &lt;value&gt;<\/pre>\n\n\n\n<p>Bear in mind however that it is not possible to put the auto_increment value back to a value less than the current maximum value in the auto_incrementing column so you may need to do some tidying first. You can find the current maximum value using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SELECT MAX( &lt;auto incrementing column&gt; ) FROM &lt;table name&gt; ;<\/pre>\n\n\n\n<p>You can confirm that the change has taken using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SHOW TABLE STATUS FROM &lt;DB name&gt; WHERE name LIKE '&lt;table name&gt;' ;<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are using the auto_increment feature of MySQL and table edits have lead to the value generated being in advance of requirements or just generally adrift you can use the following command to adjust the next auto_increment output value. ALTER TABLE &lt;table name&gt; AUTO_INCREMENT = &lt;value&gt; Bear in mind however that it is not &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/qedevelopment.co.uk\/?p=206\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;MySQL: How to Reset the AUTO_INCREMENT Value&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[18],"tags":[19],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/206"}],"collection":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=206"}],"version-history":[{"count":10,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/206\/revisions"}],"predecessor-version":[{"id":385,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/206\/revisions\/385"}],"wp:attachment":[{"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qedevelopment.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}