Get autoincremental value

Get autoincremental value

SHOW TABLE STATUS FROM `DatabaseName` WHERE `name` LIKE 'TableName' ;

Query from information schema

SELECT `AUTO_INCREMENT`
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'DatabaseName'
AND TABLE_NAME = 'TableName';

Change auto_incremental value

ALTER TABLE table AUTO_INCREMENT = n;

Leave a Reply

Your email address will not be published. Required fields are marked *