How to Fix 'Table in Use' Error in phpMyAdmin

phpMyAdmin table in usefix MySQL table permissionsAMH panel database errorchown mysql permissionsrestore locked database table
Published·Modified·

Today, while using phpMyAdmin to batch close comments for some websites, I encountered an English prompt suggesting I repair the table. After following the suggestion, a tragedy occurred: the database structure showed the table as "in use," and the website became inaccessible, as shown in the screenshot below.

Table in Use

In Use

I was using the AMH hosting panel and wondered if others had encountered similar issues. After trying to check, optimize, and repair the table without success, I had to seek help from the community. Fortunately, a helpful netizen resolved the issue, and I am sharing this solution here.

The cause of this problem was insufficient permissions. To fix it, you need to reassign permissions using an SSH tool. Run the following commands:

chown mysql:mysql -R /usr/local/mysql/*
chown mysql:mysql -R /data/mysql/*

This will reset the ownership permissions.

Next, reopen phpMyAdmin, switch to the affected database, select the table showing as "in use," and click the "Repair Table" button. You should then see the table return to normal.

My final advice is to develop the habit of regular backups. I have learned this lesson the hard way. Without backups, if your data crashes, the consequences could be regrettable.