Transaction
Transaction
MySQL Transaction
• We can understand the rollback transaction with the help of the following
illustration. First, open the MySQL command prompt and log into the
database server using the password. Next, we have to select a database.
• Suppose our database contains the "Orders" table. Now, the following are the
scripts that perform the rollback operations:
we need to open a separate session of MySQL database server and execute the
below statement to verify the data in Orders table:
• Although we have made changes in the first session, we still can see the
records are available in the table. It is because the changes are not permanent
until we have not executed the COMMIT or ROLLBACK statement in the
first session.
MySQL Table Locking
• A lock is a mechanism associated with a table used to restrict
the unauthorized access of the data in a table. MySQL
allows a client session to acquire a table lock explicitly
to cooperate with other sessions to access the table's
data.
• MySQL provides two types of locks onto the table, which
are:
• READ LOCK: This lock allows a user to only read the data
from a table.
• WRITE LOCK: This lock allows a user to do both reading and
writing into a table.
MySQL Table Locking