Mysql error can’t reopen table: How to fix it


Temporary tables also called temp tables in Mysql is helpful in the situations when you need to save your time as well as effort by creating a temporary place in the database for such data that are frequently used within a single operation. To create mysql temporary table, you just have to execute the following statement: CREATE TEMPORARY TABLE temp_table (count int);


But at times, when you try to execute a query using temporary lookup table, you encounter the following error message similar to this on screen:

ERROR 1137 (HY000): Can't reopen table: 'tmp_journals'

This error indicates that the way in which Mysql tables manages the temporary tables has been changed which in turn affects the joins, unions as well as subqueries. To fix mysql error can’t reopen table, try out the following solution:

mysql> CREATE TEMPORARY TABLE tmp_journals_2 LIKE tmp_journals;
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO tmp_journals_2 SELECT * FROM tmp_journals;
Query OK, 3228659 rows affected (2.01 sec)
Records: 3228659 Duplicates: 0 Warnings: 0

After making the above operation, execute the query using temporary lookup table. But even if the problem remains, then there must be mysql database corruption issues due to which mysql error 1137(hy000) might occur. So, to resolve up the database corruption, the best is to use mysql repair tool that is highly helpful in the situations when mysql get damaged and consequently repair them regardless of the corruption reasons such as virus attack, unexpected system shutdown or sudden power supply, header corruption, improper opearation of tables etc. With the help of advanced techniques, competently repair the corrupt tables and help you to get rid of mysql error can’t reopen table.