Couple of days ago, I killed yumex because it hung. Afterthat, everything hung. I couldn't run rpm or yum in command line. I tried rebuilding the database with rpm --rebuild but to no avail. Found a solution after googling. The solution :
The above command removes any locks left on the rpm database and now you should able to use rpm command. Make sure you run the above command as root for obvious reason.