I am not able to reset the auto_increment value even after making changes after referring to other post
I tried :
ALTER TABLE tablename AUTO_INCREMENT = 101
ALTER TABLE users AUTO_INCREMENT=1001;
or if you haven't already added an id column, also add it
ALTER TABLE users ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,
ADD INDEX (id);
But still not working
Check this :
mysql> ALTER TABLE table2 ADD id INT UNSIGNED NOT NULL AUTO_INCREMENT,
-> ADD INDEX (id);
Query OK, 5 rows affected (0.17 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> select * from table2;
+----------------+----+
| name | id |
+----------------+----+
| Abhilash Gupta | 1 |
| John | 2 |
| Peter | 3 |
| Clarke | 4 |
| Virat | 5 |
+----------------+----+
5 rows in set (0.00 sec)
mysql> ALTER TABLE table2 AUTO_INCREMENT=101;
Query OK, 5 rows affected (0.25 sec)
Records: 5 Duplicates: 0 Warnings: 0
mysql> select * from table2;
+----------------+----+
| name | id |
+----------------+----+
| Abhilash Gupta | 1 |
| John | 2 |
| Peter | 3 |
| Clarke | 4 |
| Virat | 5 |
+----------------+----+
5 rows in set (0.00 sec)
mysql>
I want the value of id to start from 101. Thanks in advance