This error comes up because, if you give 'localhost' as the host, mysql client library will try to use the unix domain socket (file based) instead of the TCP one. And every mysql client library has one path to the Unix domain socket.
In MONyog's mysql client library it is: '/var/lib/mysql/mysql.sock'
In "phpMyAdmin", it is '/var/run/mysqld/mysqld.sock'
So if one software works the other breaks. To solve this problem:
You
can create a symbolic link to your original '/var/run/mysqld/mysqld.sock'
in '/var/lib/mysql/mysql.sock'
'/var/lib/mysql/mysql.sock' -> '/var/run/mysqld/mysqld.sock'
The command to create this is:
ln -s /var/run/mysqld/mysqld.sock /var/lib/mysql/mysql.sock
This will create a symbolic link '/var/lib/mysql/mysql.sock'
to '/var/run/mysqld/mysqld.sock'.
So both the applications will work.
You can keep '/var/run/mysqld/mysqld.sock' as it is. And you can force MONyog to use TCP based connection specifying "127.0.0.1" as the host instead of 'localhost'.