mtop - Access denied for user root

Written by Peter Davies on .

This had occured on multiple systems:

root@server:~# apt-get install mtop
Reading package lists... Done
Building dependency tree
Reading state information... Done
mtop is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Setting up mtop (0.6.6-1.4) ...
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
dpkg: error processing mtop (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 mtop
E: Sub-process /usr/bin/dpkg returned an error code (1)

Reset MySQL root password during install then re-enable it:

$ mysql -u root -p

Enter the following MySQL command:

>SET PASSWORD FOR root@localhost=PASSWORD('');QUIT;

So, re-install mtop

apt-get install mtop

set MySQL root password to its previous value:

$ mysql -u root -p
>SET PASSWORD FOR root@localhost=PASSWORD('oldpass');QUIT;

Resources [1] https://bugs.launchpad.net/ubuntu/+source/mtop/+bug/77980

Update: I prefer "mytop" as its much more similar to "top".