Jump to content

Repairing tables


Recommended Posts

Posted

Hello ! :)

I've had a problem to day... I don't know what hapened :
- My web site and server became impossible to access...
- I lost my access to my server (was banned from it, but I have other connexions so I used them to remove my IP from the firewall deny list).
- When I had access again, I noticed the database was corrupted.

So I ran a repair using phpmyadmin. It returned many errors. I noticed this one saying that one client is using or hasn't closed the table properly. Then I ran this after shutting down mysql :

root@server [/var/lib/mysql/myforums_forums]# myisamchk --silent --force --fast --update-state -O key_buffer=1024M -O sort_buffer=1024M -O read_buffer=10M -O write_buffer=10M *.MYI

and it returned :

myisamchk: MyISAM file ibf_cache_store.MYI
myisamchk: warning: 1 client is using or hasn't closed the table properly
myisamchk: MyISAM file ibf_cache_store.MYI
myisamchk: error: Size of datafile is: 1030228 Should be: 1030312
myisamchk: MyISAM file ibf_core_item_markers.MYI
myisamchk: warning: 1 client is using or hasn't closed the table properly
myisamchk: MyISAM file ibf_core_item_markers_storage.MYI
myisamchk: warning: 1 client is using or hasn't closed the table properly
myisamchk: MyISAM file ibf_core_item_markers_storage.MYI
myisamchk: error: Size of indexfile is: 27648 Should be: 30720
myisamchk: error: Size of datafile is: 39229268 Should be: 43866580

It seems like the repair didn't work ?...

Moreover, I have to run phpmyadmin after myisamchk because using myismachk like I did returned a database driver error. Why is this so ?

Can you help me ?

Thank you ! :)

Posted

It looks like that when you tried to repair the tables, they have been updated by another program (such as the mysqld server) that hasn't yet closed the file or that has died without closing the file properly, which can sometimes lead to the corruption of one or more MyISAM tables.

If mysqld is running, you must force it to flush any table modifications that are still buffered in memory by using FLUSH TABLES. You should then ensure that no one is using the tables while you are running myisamchk.

Posted

Hello ! :)



Before running phpmyadmin, I had turned the board offline. So, this wasn't sufficient ?


Before running myisamchk I shut down mysql, but I hadn't used FLUSH TABLES.




Turning the board off line shouldn't have had any affect. Instead the mysqld should be shutdown before performing the repair. Anyway, try to flush them and see if that would help.
Posted

I flushed the tables, then I typed mysqladmin shutdown, ran myisamchk and got no error messages.



Thank you ! :)




You are most welcome. Glad to hear that you fixed it :)

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...