Com o comando mysqlcheck podemos verificar se um determinado banco ou tabela de um banco está integro, sem erros ou corrompido. Mostrarei algumas de suas opções das diversas que existem.
-
Verificando uma determinada tabela
-
Verificando um banco inteiro
Em testes que precisei no banco de um zabbix server, tive o seguinte resultado abaixo, mostrando que “algo de errado não estava certo”, ou seja, com erros.
zabbixdb.group_prototype OK zabbixdb.groups OK zabbixdb.history warning : Table is marked as crashed warning : 1 client is using or hasn't closed the table properly error : record delete-link-chain corrupted error : Corrupt zabbixdb.history_log OK zabbixdb.history_text OK zabbixdb.history_uint warning : Table is marked as crashed warning : 1 client is using or hasn't closed the table properly error : record delete-link-chain corrupted error : Corrupt zabbixdb.host_discovery OK zabbixdb.host_inventory OK
-
Corrigindo erros de um banco
Obtive o seguinte resultado, corrigindo assim os erros que tive no banco:
zabbixdb.group_prototype OK zabbixdb.groups OK zabbixdb.history warning : Number of rows changed from 5764036 to 5763139 status : OK zabbixdb.history_log OK zabbixdb.history_text OK zabbixdb.history_uint warning : Number of rows changed from 13583760 to 13633846 status : OK zabbixdb.host_discovery OK zabbixdb.host_inventory OK
FONTES
MySQL: use o mysqlcheck para fazer manutenção das suas tabelas