How to allow remote connections to mysql from specific IPs only?
You can use hostname in grant statements as well, as you are using shared ip then you can limit it with hostname specific grant such as below

grant all on db.* to 'user'@'hostname' identified by 'password';


To allow from all IP's/hosts

grant all on db.* to 'user'@'%' identified by 'password';


For localhost only

grant all on db.* to 'user'@'localhost' identified by 'password';