Ostatnio jedna z instancji mysql po restarcie zamiast wstać sypała logami:

mysqld: /usr/sbin/mysqld: Table ’./mysql/plugin’ is marked as crashed and last (automatic?) repair failed

mysqld: /usr/sbin/mysqld: Table ’./mysql/host’ is marked as crashed and last (automatic?) repair failed

Powodem jest zamarkowanie tabeli, jako crashed. Serwer zatrzymany, więc pytanie jak naprawić tabelę?

Z pomocą przychodzi skrypcik szymana:

#! /bin/bash

/etc/init.d/mysql stop

base=”/var/lib/mysql/”

cd $base

lll=`ls`

for i in $lll.

do

if [ -d $i ];

then

myisamchk -rf $i/*.MYI

fi

done

/etc/init.d/mysql restart

mysql is marked as crashed and last (automatic?) repair failed – rozwiązanie problemu