Looked at this error
debconf: DbDriver "config": /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable
You need to solve this before re-install phpmyadmin
.
Run this command to clear it.
sudo rm /var/cache/debconf/*.dat
Edit
Based on attempt 2 error
dpkg: error processing package phpmyadmin (--remove): installed phpmyadmin package pre-removal script subprocess returned error exit status 10
We can remove the dpkg files manually by running below code:
rm -r /var/lib/dpkg/info/phpmyadmin.*
More details can be found on Trying to uninstall phpmyadmin "dpkg: error while cleaning up:"