1. Home
  2. Knowledge Base
  3. Problems (EN)
  4. How to solve a corruption problem in the MySQL database?

How to solve a corruption problem in the MySQL database?

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:

  1. With the mysql service stopped, delete the content of the /var/lib/mysql directory or the datadir directory configured in the environment.
  2. 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.
  3. We create the Pandora FMS database again and access it:
mysql > create database pandora;
mysql > use pandora;
  1. We will import the database backup in this new created database.
mysql > source <dump_backup.sql>;
  1. 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';
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support

Recent Discussions