Programming Tips
  • Home
  • Frameworks
    • Laravel
    • CakePHP
  • Magento
    • Magento 2
    • Magento 1
  • PHP
  • JavaScript
    • jQuery
  • CSS
  • Other
    • htaccess
    • SSH
    • Server Management
  • Hosting
Select Page

How to reset AUTO_INCREMENT in MySQL and start counting from 1 again?

Nov 13, 2019 | MySQL | 0 comments

Let say you have a table called “my_table” with an auto-increment column called “id” and you want the id column to start counting from 1,2,3,… then use the following SQL queries.

SET  @num := 0;

UPDATE my_table SET id = @num := (@num+1);

ALTER TABLE my_table AUTO_INCREMENT =1;
Share on Twitter Share on Facebook Share on LinkedIn Share on Email Share on WhatsApp Share on Telegram

Search

Categories

  • Cloudflare
  • CMS
    • Joomla
      • Joomla Templating
      • K2
      • T3 Framework
  • CSS
  • Excel
  • FaceBook
  • Frameworks
    • CakePHP
  • General
  • Git
  • JavaScript
    • AJAX
    • jQuery
    • MooTools
  • Magento 1
  • MySQL
  • PayPal
  • PHP
  • Security
    • htaccess
    • Server Management
    • SSH
  • Ubuntu
  • Uncategorized
  • WHMCS

Tag Cloud

AJAX CakePHP CakePHP 2 Cart Cloudflare CSS CSS3 Envato Error facebook facebook comments Git GoDaddy htaccess IP address IPv4 IPv6 JavaScript Joomla Joomla 1.5 JQuery K2 Magento 1 MySQL PHP Price Programmatically Rule Security Server Management Shopping SSH T3 Framework url warning

Recent Comments

  • Piter entity on Magento – How to create a special price (sale) page? (with new products first)
  • ILDaviz on Magento Dataflow Export/Import form the command line
  • ala on Warning: Parameter 2 to frontpage() expected to be a reference
  • Support PaceTech on Magento: Rating showing twice on product pages
  • Susanta Kumar Das on Magento Dataflow Export/Import form the command line
  • Privacy Policy
  • Terms of Use
  • Facebook
  • Twitter
  • RSS

Designed by Elegant Themes | Powered by WordPress