(866) 366-3640 - support@sagonet.com
Sago Logo
Banner

   
Log in / create account Page Discussion History Go to the site toolbox
MySQL Table Recovery to the Extreme

First log into phpMyAdmin and click on the database. Then click the checkbox next to the table, scroll down, and select a Repair. IT will probably tell you Ok whether it worked or not. So go back to the same screen and run a check to see if it worked.

Screen shots:

http://paulstamatiou.com/2006/05/31/how-to-quickie-repair-mysql-tables-in-phpmyadmin

Still crashed/corrupted??

Log into SSH, stop the mySQL server, and change directory to the directory where the mySQL data file for that table is stored: cd /var/lib/mysql/database_name

Use myisamchk to repair the table: myisamchk table_name.MYI myisamchk -r table_name.MYI

You can use myisamchk without any options to check the table from the command-line...If there are no errors, go ahead and start mySQL back up and you are done!

Still crashed/corrupted??

This is a more extreme method of recovery and should only be used if you've tried everything else... !!FIRST MAKE A BACKUP OF THE DATA FILES!!! Now log into mySQL as root, and perform these commands: mysql -u root -p mysql> use database_name; mysql> SET AUTOCOMMIT=1; mysql> TRUNCATE TABLE table_name; mysql> exit;

Now...copy the .MYD file that you made a backup of back to the original data directory for the database. And then run: myisamchk -r table_name.MYI

That command will rebuild the table structure from the data file. As long as the data file itself is not corrupt, then you should be able to rebuild and have everything work.