How do I "repair" a mysql table on my remote server ?

6 posts / 0 new
Last post
#1 Sat, 08/21/2010 - 08:11
Anonymous

How do I "repair" a mysql table on my remote server ?

Hi, I tried to access my database via the "Edit Databases" in the VirtualMin but I get this message:

SQL show index from c2s_main failed : Table './guru777/c2s_main' is marked as crashed and should be repaired

Is there a way to run a repair from VirtualMin or do I need to do this via a command line such as putty ?

Thanks.

Sat, 08/21/2010 - 08:27
andreychek

Howdy,

I don't believe there's a way to do that from the Virtualmin GUI.

However, there are a few tools provided by MySQL to help you do that from the command line.

MySQL provides instructions on how to repair databases here:

http://dev.mysql.com/doc/refman/5.0/en/myisam-repair.html

Scroll down to where it says "Stage 1: Checking your tables", and start from there. However, be sure to note the warning from the preceding paragraph, that reminds you that you need to stop MySQL before running the repairs. You can stop MySQL by running this command:

/etc/init.d/mysqld stop

Then you can step through the instructions they have in there.

-Eric

Sat, 08/21/2010 - 09:56
Davvit

Thanks for the input.

I am using putty and I stopped the mysql OK with that command.

then I typed in myisamchk -c *.myi

After reading the instructions carefully, I thought this would check all of the tables, but I got this reply:

File '*.myi' doesn't exist

Do I need to specify the path ? - I thought that it should find all the tables .

Thanks

Sat, 08/21/2010 - 09:59
andreychek

Howdy,

Those instructions are assuming that, as the root user, you've moved into the directory containing the tables you want to repair.

By default, MySQL stores it's databases in /var/lib/mysql. So if you're looking to repair the tables for a database named "guru777", you'd want to "cd" into that dir by running:

cd /var/lib/mysql/guru777

And then run the myisamchk program as you did above.

-Eric

Sat, 08/21/2010 - 11:47
Davvit

Thanks very much for your help :)

I fixed the table with the -r and it seems to be ok now.

Sat, 08/16/2014 - 18:57
supernal

I registered an account on this site for the sole purpose of making a comment here. I ran into a very similar issue and andreychek's posts were instrumental in resolving my issue. So thanks very much! I don't care if it is 4yrs old, the people need to know.

Topic locked