Login to MySQL:
mysql -u your_user -p
Then run:
USE your_discuz_db; # My DB name is ultrax. SHOW TABLE STATUS WHERE Comment LIKE '%crashed%';
In my case, I can see 3 tables crashed. The output confirms that the key Discuz tables (pre_forum_post
,pre_forum_sofa
, andpre_forum_thread
) are badly corrupted. Step-by-Step Recovery withmyisamchk
Becausemyisamchk
works on raw table files, MySQL must not be running:sudo systemctl stop mysql
Step 1: Navigate to the Data Directory MySQL table files are usually stored in:cd /var/lib/mysql/ultrax/
Step 1: Navigate to the Data Directory
MySQL table files are usually stored in:
cd /var/lib/mysql/ultrax/
Step 2: Run myisamchk
on the Crashed Tables
Try repairing the .MYI
(index) and .MYD
(data) files:
sudo myisamchk -r -v pre_forum_post
sudo myisamchk -r -v pre_forum_sofa
sudo myisamchk -r -v pre_forum_thread
If you get errors, try more aggressive repair:
sudo myisamchk -o -v pre_forum_post
sudo myisamchk -o -v pre_forum_sofa
sudo myisamchk -o -v pre_forum_thread
And if that still fails:
sudo myisamchk -f -v pre_forum_post
sudo myisamchk -f -v pre_forum_sofa
sudo myisamchk -f -v pre_forum_thread
The
-f
flag forces recovery, even if corruption is bad.
Step 3: Start MySQL Again
sudo systemctl start mysql
Step 4: Check Tables Again
Login to MySQL:
mysql -u your_user -p
Then:
USE ultrax;
CHECK TABLE pre_forum_post, pre_forum_sofa, pre_forum_thread;
No Comments