The mailserver is not configured to serve web requests. Therefore the control panel will be hosted on a different server and must create a remote connection to the MySQL-server. When you see the following error:
mysql -hmailserver.example.com -uuser -p ERROR 2003 (HY000): Can't connect to MySQL server on 'mailserver.example.com' (111)
this means the database server is probably bound to 127.0.0.1.
/etc/mysql/my.cnf and comment out the following line:
bind-address = 127.0.0.1
Restart MySQL after changing the file.