Problem in innodb inserting records

I have table which is MyIsam engine use and it reaches autoincremented 12 as for my test data,…when I tried to convert the table.and truncate the table or drop and re-create the table. And manually insert 1 record in the table for default user,then,when I tried to insert record using my forms,the records did not show in the table but it successfully inserted…I don’t know why.

Thank you in advance.

Is your script reporting the insert as having been successful when in fact it has failed? You might have a bug in your script. Is it a PHP script?

My insert statement in my php script is ok,…I tried in MyIsam and it inserted and I can see the records in the table,but when I tried in INNODB php reported inserted successfully.but the record is not in the table.maybe it’s because I manually start my auto-incremented id to 1 after i converted to innodb,but in MyIsam engine i already use 12 auto-incremented id.

'Thank you in advance.

how can you reset your auto-incremented id, in ENGINE=InnoDB ?


The number is the value you want it to start from. afaik it doesn’t make any difference as to what storage engine is in use


so if myIsam already use 12 autoincremented,then if convert my table to innodb engine and issue an ALTER TABLE da_table AUTO_INCREMENT = 1; ? i can start my autoincremented id to 1 ?.

No, even if you set it to 1, it will automatically set itself to the lowest possible value. Which if you already have id, 1,2,3,4,5,6,7,8,9,10,11,12 would be 13.

If you still have problems with inserting into InnoDB, check if auto-commit is turned off.

To utilize the full power of InnoDB you want to use transactions, where you start the transaction, and then commit after your finished adding/updating the database content. Using transactions will allow you to roll back if needed, if for example you have updated four tables successfully, but on the next update something fail, you can roll back all changes and your data is still in sync.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.