MySQL does not support transaction processing workaround
July 07, 2014 23:20 Encyclopedia 369
MySQL does not support transaction processing workaround
The default storage engine type for MySQL database is MyISAM, which does not support transactional processing.
In MySQL, only data tables with the InnoDB storage engine type can support transactions.
Therefore, if you want MySQL to support transactional processing, simply modify the data table to the InnoDB storage engine type. The procedure is as follows:
1. Go to the phpMyAdmin main interface and in the navigation panel select the database you want to convert to the InnoDB storage engine type, for example, select the Db_xuesheng database. As shown in the following:
2. At the top of the main screen, click on the "SQL" hyperlink to open the "Run SQL query in Database Db_xuesheng" window. As shown in the following:
3. In the window, enter
Show engines;
SQL command.
4. Click the "Execute" button in the bottom right corner of the window to open the "Show Query Box" page. As shown in the following:
5. On the Show Query box page, we find that the transactions entry for the InnoDB type is yes, which means that the InnoDB type of database or data table supports transactional processing.
Below, we can support transaction operations simply by modifying the related data table to the InnoDB storage engine type.
6. In the phpMyAdmin navigation panel, select the database Db_xuesheng to modify the storage engine type, and then click the SQL hyperlink at the top of the main interface to open the run SQL query in Database Db_xuesheng window. As shown in the following:
7. In the Query window, enter
ALTER TABLE Tb_chengji ENGINE = InnoDB;
SQL command.
If you enter
ALTER TABLE ' Tb_chengji ' ENGINE = InnoDB;
SQL commands are also OK.
' Tb_chengji ' on both sides of the symbol is in English input case, press the key to hit out:
8. Click the "Execute" button in the lower right corner to open the "SQL" hyperlink window. As shown in the following:
9. At this point, the data table has been successfully converted from the MyISAM storage engine type to the InnoDB storage engine type.
We can also perform transactional operations in the data table!