nav100
nav100

Reputation: 3133

strange issue with auto number field in MySQL

I have created a table which has auto increment field. I inserted a few records and deleted them. We had to change the php.ini file and restarted the machine. The auto increment field started from 1 again. I have a web site which uses Joomla running on windows server 2008. It looks like PHP and MySQL are integrated with Joomla. I am new to PHP and MySQL server. Please let me know what could be the issue? I am running PHP 5.3.8 and MySQL server 5.0. Thank you for any help.

Upvotes: 0

Views: 193

Answers (2)

Vijeenrosh P.W
Vijeenrosh P.W

Reputation: 369

That should not happen normaly . But as an remedy you could use the following query to reset the auto increment counter to the previously last value .

ALTER TABLE theTableInQuestion AUTO_INCREMENT=newalue , so that you could continue with t

able as usual by setting newvalue = last autoincrementvalue +1

Upvotes: 1

Dipu Raj
Dipu Raj

Reputation: 1884

Are you using the TRUNCATE or DELETE command to delete the data? If it is TRUNCATE it will reset the auto increment value.

Upvotes: 1

Related Questions