{"id":5307,"date":"2024-10-29T09:41:20","date_gmt":"2024-10-29T09:41:20","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=5307"},"modified":"2024-10-29T09:41:40","modified_gmt":"2024-10-29T09:41:40","slug":"how-to-reset-auto-increment-in-mysql","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/","title":{"rendered":"How to Reset Auto Increment in MySQL"},"content":{"rendered":"\n<p>MySQL database features Auto Increment that generates a unique sequential ID for each table row. It is a column constraint that allows you to uniquely identify each row in a table. It is commonly applied to primary key fields of database tables. Often database programmers and software developers need to reset auto increment in MySQL. In this article, we will learn how to do this.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#What_is_Auto_Increment_in_MySQL\" >What is Auto Increment in MySQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#Why_Reset_Auto_Increment_in_MySQL\" >Why Reset Auto Increment in MySQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#How_to_Reset_Auto_Increment_in_MySQL\" >How to Reset Auto Increment in MySQL<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#1_Using_ALTER_Table_Statement\" >1. Using ALTER Table Statement<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#2_Using_Truncate_Table\" >2. Using Truncate Table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#3_Using_Drop_Table_with_Create_Table\" >3. Using Drop Table with Create Table<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Auto_Increment_in_MySQL\"><\/span>What is Auto Increment in MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Auto Increment is a feature available in all database systems, including MySQL, that automatically generates unique IDs for each row in a table. It is a column property that can be set at the time of table creation, or afterwards, by modifying column properties. It generates unique sequential number for each row in a table to uniquely identify it. It is often used for primary key columns of the table.<\/p>\n\n\n\n<p>If you delete a row, its auto increment ID will not be reused. Updating row contents does not change Auto increment value of the row. By default, auto increment value starts from 1 with an increment of 1. Depending on your requirement, you can not only change the starting value but also the increment value.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Why_Reset_Auto_Increment_in_MySQL\"><\/span>Why Reset Auto Increment in MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Sometimes database developers and administrators need to reset auto increment&#8217;s starting value or increment or both. This may be because of some programming problems or because there have been too many insertions and deletions and your auto increment values are messed up and hard to understand. <\/p>\n\n\n\n<p>For example, let us say you have 5 rows in a table with auto increment column having values 1, 2, 3, 4, 5. Let us say you just deleted a couple of latest rows in your table. Next, when you insert a row in this table, the auto increment column will assign value of 6 to this column and not 4. In this case, you will need to reset auto increment column. This is shown below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Reset_Auto_Increment_in_MySQL\"><\/span>How to Reset Auto Increment in MySQL<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>There are mainly 3 different ways to reset auto increment in MySQL. We will look at it one by one. Let us say you have the following MySQL table <em>orders<\/em> with id column having AUTO_INCREMENT constraint.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql> create table orders(<br>     id int auto_increment,<br>     primary key(id),<br>     product_name varchar(255),<br>     order_date date<br>);<\/pre>\n\n\n\n<p>Let us say you insert the following data in the above table.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; insert into orders(product_name,order_date) <br>       values('A','2024-10-28'),<br>             ('B','2024-10-29'),<br>             ('C','2024-10-30');<br><br>mysql&gt; select * from orders;<br>+----+--------------+------------+<br>| id | product_name | order_date |<br>+----+--------------+------------+<br>|  1 |      A       | 2024-10-28 |<br>|  2 |      B       | 2024-10-29 |<br>|  3 |      C       | 2024-10-30 |<br>+----+--------------+------------+<\/pre>\n\n\n\n<p>As you can see, the ID column has been auto populated with unique sequential numbers. When you insert another row in the above table, MySQL will automatically assign id=4 for this new row. But if you delete a row and add a new row then ID will still be assigned value 4. What if you do not want it to be this way? We will see several ways to control the value of auto increment below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Using_ALTER_Table_Statement\"><\/span>1. Using ALTER Table Statement<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>ALTER TABLE statement allows you to make changes to the modify the structure of tables and its columns. It can be used to add, remove or update columns. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ALTER TABLE table_name AUTO_INCREMENT = new_value;<\/pre>\n\n\n\n<p>Let us say you delete row with id=3.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; delete from orders where id=3;<br><br>mysql &gt; select * from orders;<\/pre>\n\n\n\n<p>Now if you insert a new row to this table, then the ID column will have value of 4 and not 3.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; insert into orders(product_name,order_date) <br>       values('D','2024-10-30');<br><br>mysql&gt; select * from orders;<br>+----+--------------+------------+<br>| id | product_name | order_date |<br>+----+--------------+------------+<br>|  1 | A            | 2024-10-28 |<br>|  2 | B            | 2024-10-29 |<br>|  4 | D            | 2024-10-30 |<br>+----+--------------+------------+<\/pre>\n\n\n\n<p>Instead, you can reset the auto increment value of ID column to 3, after you delete row with id=3.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql> delete from orders where id = 4;<br><br>mysql> ALTER TABLE data AUTO_INCREMENT = 3;<\/pre>\n\n\n\n<p>Now let us try to insert a new row into data table.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; insert into orders(product_name,order_date)        <br>       values('D','2024-10-30');<br><br>mysql&gt; select * from orders;<br>+----+--------------+------------+<br>| id | product_name | order_date |<br>+----+--------------+------------+<br>|  1 | A            | 2024-10-28 |<br>|  2 | B            | 2024-10-29 |<br>|  3 | D            | 2024-10-30 |<br>+----+--------------+------------+<\/pre>\n\n\n\n<p>Now you will see that the auto increment column has id=3 and it has resumed auto numbering from 3.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Using_Truncate_Table\"><\/span>2. Using Truncate Table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Another option is to delete all data from your table. Obviously, you can copy the data to another table and copy it back afterwards, thereby resetting your auto increment column. <\/p>\n\n\n\n<p>To delete all rows of a table, use TRUNCATE table command. Here is its syntax.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">TRUNCATE TABLE table_name;<\/pre>\n\n\n\n<p>It will delete all rows of the table and reset the auto increment column to 0. When you insert a new row to this empty table, it will be assigned id=1.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; truncate table orders;<br><br>mysql&gt; select * from orders;<br>Empty set (0.00 sec)<\/pre>\n\n\n\n<p>Now let us try inserting 3 rows, you will see that the ID column starts from 1.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; select * from orders;<br>+----+--------------+------------+<br>| id | product_name | order_date |<br>+----+--------------+------------+<br>|  1 | A            | 2024-10-28 |<br>|  2 | B            | 2024-10-29 |<br>|  3 | D            | 2024-10-30 |<br>+----+--------------+------------+<\/pre>\n\n\n\n<p>Generally, if you delete one or more rows from a table with an auto increment column and then insert some rows in it, you will see that auto increment does not reset to 1. It will continue from its previous maximum value. <\/p>\n\n\n\n<p>But when you use truncate table command to delete all rows from a table, it resets the auto increment. For example, let us try deleting all rows of the above table using delete table command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; delete from orders;<\/pre>\n\n\n\n<p>Now let us insert the above 3 rows once again.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; insert into orders(product_name,order_date)<br>            values('A','2024-10-28'),<br>                  ('B','2024-10-29'),<br>                  ('D','2024-10-30');<br><br>mysql&gt; select * from orders;<br>+----+--------------+------------+<br>| id | product_name | order_date |<br>+----+--------------+------------+<br>|  4 | A            | 2024-10-28 |<br>|  5 | B            | 2024-10-29 |<br>|  6 | D            | 2024-10-30 |<br>+----+--------------+------------+<\/pre>\n\n\n\n<p>As you can see, the auto increment value has not been reset. So you should only use TRUNCATE table statement for emptying a table, if you want to reset auto increment column.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Using_Drop_Table_with_Create_Table\"><\/span>3. Using Drop Table with Create Table<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In the above method, only the data is deleted but the table&#8217;s structure remains intact. You can also use DROP TABLE statement to completely delete the entire table and recreate it using create table.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; drop table orders;<br><br>mysql&gt; create table orders(<br>         id int auto_increment,<br>         primary key(id),<br>         product_name varchar(255),<br>         order_date date<br>    );<\/pre>\n\n\n\n<p>The above method will create a new table with auto increment column starting from 1.<\/p>\n\n\n\n<p><strong>Please note<\/strong>, when you reset auto increment to a specific value, MySQL will check if the auto increment column has that value or not. If you set auto increment to a value that is already present in the column, then MySQL will automatically start after the maximum value of that column. For example, if ID column has values 1, 2, 3, 4, 5 and you reset auto increment column&#8217;s value to 3, MySQL will not give any error. But when you insert a new row, ID will be assigned value 6.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt several ways to reset auto increment column in MySQL. If you do not want to delete any of the rows of your table, then use ALTER TABLE statement. If you are planning to empty the table and repopulate it, then use TRUNCATE TABLE statement.<\/p>\n\n\n\n<p>Also read:<\/p>\n\n\n\n<p><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-list-users-in-mysql\/\">How to List Users in MySQL<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-remove-item-from-array-in-javascript\/\">How to Remove Item from JavaScript Array<\/a><br><a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-get-character-set-of-mysql-database-or-table-or-column\/\">How to Get Character Set of MySQL<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes database developers need to reset auto increment column in MySQL. Here are different ways to set the auto increment value.<\/p>\n","protected":false},"author":1,"featured_media":5335,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[324],"tags":[328],"class_list":["post-5307","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","tag-reset-auto-increment"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Reset Auto Increment in MySQL - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Sometimes database developers need to reset auto increment column in MySQL. Here are different ways to set the auto increment value.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Reset Auto Increment in MySQL - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Sometimes database developers need to reset auto increment column in MySQL. Here are different ways to set the auto increment value.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2024-10-29T09:41:20+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-29T09:41:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"319\" \/>\n\t<meta property=\"og:image:height\" content=\"213\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Reset Auto Increment in MySQL\",\"datePublished\":\"2024-10-29T09:41:20+00:00\",\"dateModified\":\"2024-10-29T09:41:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/\"},\"wordCount\":984,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg?fit=319%2C213&ssl=1\",\"keywords\":[\"reset auto increment\"],\"articleSection\":[\"MySQL\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/\",\"name\":\"How to Reset Auto Increment in MySQL - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg?fit=319%2C213&ssl=1\",\"datePublished\":\"2024-10-29T09:41:20+00:00\",\"dateModified\":\"2024-10-29T09:41:40+00:00\",\"author\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Sometimes database developers need to reset auto increment column in MySQL. Here are different ways to set the auto increment value.\",\"breadcrumb\":{\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg?fit=319%2C213&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg?fit=319%2C213&ssl=1\",\"width\":319,\"height\":213,\"caption\":\"reset auto increment in mysql\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ubiq.co\/tech-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Reset Auto Increment in MySQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#website\",\"url\":\"https:\/\/ubiq.co\/tech-blog\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/\"],\"url\":\"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Reset Auto Increment in MySQL - Ubiq BI","description":"Sometimes database developers need to reset auto increment column in MySQL. Here are different ways to set the auto increment value.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/","og_locale":"en_US","og_type":"article","og_title":"How to Reset Auto Increment in MySQL - Ubiq BI","og_description":"Sometimes database developers need to reset auto increment column in MySQL. Here are different ways to set the auto increment value.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2024-10-29T09:41:20+00:00","article_modified_time":"2024-10-29T09:41:40+00:00","og_image":[{"width":319,"height":213,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Reset Auto Increment in MySQL","datePublished":"2024-10-29T09:41:20+00:00","dateModified":"2024-10-29T09:41:40+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/"},"wordCount":984,"commentCount":0,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg?fit=319%2C213&ssl=1","keywords":["reset auto increment"],"articleSection":["MySQL"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/","name":"How to Reset Auto Increment in MySQL - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg?fit=319%2C213&ssl=1","datePublished":"2024-10-29T09:41:20+00:00","dateModified":"2024-10-29T09:41:40+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Sometimes database developers need to reset auto increment column in MySQL. Here are different ways to set the auto increment value.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg?fit=319%2C213&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg?fit=319%2C213&ssl=1","width":319,"height":213,"caption":"reset auto increment in mysql"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-reset-auto-increment-in-mysql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Reset Auto Increment in MySQL"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2024\/10\/reset-auto-increment-mysql.jpg?fit=319%2C213&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-1nB","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=5307"}],"version-history":[{"count":37,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5307\/revisions"}],"predecessor-version":[{"id":5345,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/5307\/revisions\/5345"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/5335"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=5307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=5307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=5307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}