Not able to connect to local MySql database "only" when connected to VPN on VM
I'm fairly certain the MySQL not only has users listed by name and password, but also by "where they are coming from".  You may want to check and make sure the user is listed as being allowed to connect from "localhost".