MySQL in your configuration example is binded locally to the address localhost (or to be clear to the IP-Address 127.0.0.1). If you want to connect through your servers public IP-Address the access gets rejected.
You can see this by doing a netstat -ln
or in new style with the command ss
.
The removal and re-installation replaced some configuration files of MySQL. apt-get purge
deletes configuration files, also for dependent packages. Typically MySQL is only binded to localhost on a new installation on Ubuntu so this looks like your config file of MySQL was replaced with the default. For other Distros I can't say anything about the default configuration.
If you want to use a MySQL-Administration-Tool (i. e. HeidiSQL) on your local machine you should not change the bind-address
in the MySQL-Config to the public IP-Address. It's better if you use a SSH-Tunnel.
With the standard Linux-Command ssh
this is very easy to achieve with ssh -L 9999:localhost:3306 <servername>
where 9999
is the local port. You can also use the MySQL-Port 3306 as local port, but may this won't work if you have a local installation of MySQL. On Windows this can also be done with putty, just look on Google for "putty mysql tunnel", maybe this tutorial should do it, but as I am a pure Linux user i cannot verify it.