Question: I have a user table, and I have 5 records.

I deleted two records, then executed the rollback command, it executed successfully.

But that deleted two records not recovered.

The user table engine is [InnoDB](http://en.wikipedia.org/wiki/InnoDB).

Answer: 
You should be able to rollback your transaction as the table engine is InnoDB.
![enter image description here](https://i.stack.imgur.com/UOcJS.png)

Anyways here is the correct way to do transactions,

```
SET autocommit=0;
START TRANSACTION; 
Your Query here.
ROLLBACK;

```

and make sure that you are not using `COMMIT` after the Query which you need to rollback. Refer
[Table Engines](http://dev.mysql.com/doc/refman/5.6/en/storage-engines.html) and [Transaction](http://dev.mysql.com/doc/refman/5.0/en/commit.html). And When a DB connection is created, it is in auto-commit mode by default. This means that each individual SQL statement is treated as a transaction and is automatically committed right after it is executed. So if you need to do transactions yourself, you must turn off the autocommit mode by `AUTOCOMMIT = 0`. Refer this [link](http://dev.mysql.com/doc/refman/5.0/en/innodb-implicit-commit.html) for more info.
```
SET autocommit=0;
BEGIN;
.
.
.
ROLLBACK;

```

[START TRANSACTION, COMMIT, and ROLLBACK Syntax](http://dev.mysql.com/doc/refman/5.0/en/commit.html)