Yum Update – Fatal error, run database recovery

We had some security updates to run on one of our servers and came across this error when executing sudo yum update:
Fatal error, run database recovery. So being the obedient sort we are, running a database recovery is what we did.

To run database recovery, execute the following commands as root:

rm -f /var/lib/rpm/__db*
This removes all of the existing database entries (the ones that are failing as per the error above).

rpm –rebuilddb
This rebuilds the databases you just removed (deleted)

yum clean all
This cleans it all up and allows you to run any new yum commands without error (we hope).