[root@mylinux ~]# rpm -qa | grep -i mysql
error: rpmdb: BDB0113 Thread/process 9835/139934256834624 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 - (-30973)
error: cannot open Packages database in /var/lib/rpm
error: rpmdb: BDB0113 Thread/process 9835/139934256834624 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages database in /var/lib/rpm
这是由于rpm数据库被损坏了,如何修复?
[root@mylinux ~]# cd /var/lib/rpm
[root@mylinux rpm]# ll
total 78272
-rw-r--r--. 1 root root 2940928 May 7 23:17 Basenames
-rw-r--r--. 1 root root 8192 Jan 2 12:35 Conflictname
-rw-r--r-- 1 root root 270336 Jun 17 14:52 __db.001
-rw-r--r-- 1 root root 81920 Jun 17 14:52 __db.002
-rw-r--r-- 1 root root 1318912 Jun 17 14:52 __db.003
-rw-r--r--. 1 root root 684032 May 7 23:17 Dirnames
-rw-r--r--. 1 root root 20480 May 7 23:17 Group
-rw-r--r--. 1 root root 12288 May 7 23:17 Installtid
-rw-r--r--. 1 root root 36864 May 7 23:17 Name
-rw-r--r--. 1 root root 16384 May 7 23:17 Obsoletename
-rw-r--r--. 1 root root 72675328 May 7 23:17 Packages
-rw-r--r--. 1 root root 1875968 May 7 23:17 Providename
-rw-r--r--. 1 root root 204800 May 7 23:17 Requirename
-rw-r--r--. 1 root root 61440 May 7 23:17 Sha1header
-rw-r--r--. 1 root root 40960 May 7 23:17 Sigmd5
-rw-r--r--. 1 root root 8192 Dec 31 12:55 Triggername
[root@mylinux rpm]# rm -rf __db.00* -- 删除掉__db.00开头的数据库文件
[root@mylinux rpm]# rpm --rebuilddb -- 重建rpm数据库
[root@mylinux rpm]# yum -- 随便运行一个yum命令,就会出现新的数据库文件
Loaded plugins: langpacks, versionlock
You need to give some command
Usage: yum [options] COMMAND
List of Commands:
略