If we have any table from the Pandora FMS database that appears in a corrupt state and there are problems when reading and/or writing to it, we can execute the following command so that it tries to repair the table by itself.
mysqlcheck -f -o -e --auto-repair -u root -p pandora
In case the repair is not done correctly or directly this command cannot be executed, our recommendation is that you rebuild the Pandora FMS database and the mysql engine completely again. To do this you need to recover a backup that you have from the same and follow these steps:
- With the mysql service stopped, delete the content of the
/var/lib/mysql
directory or thedatadir
directory configured in the environment. - Start the mysql service. At this point all files of the mysql engine will be generated again. The root password will be lost, in mysql versions 5.7 or higher a random password will be generated and indicated in the mysql log. We will access with it and modify it to our liking in the first access.
- We create the Pandora FMS database again and access it:
mysql > create database pandora; mysql > use pandora;
- We will import the database backup in this new created database.
mysql > source <dump_backup.sql>;
- The last step is to give the GRANT needed for the access of the different elements of Pandora FMS.
GRANT ALL PRIVILEGES on pandora.* to '<user>'@'localhost' identified by 'password';