The best way it to put restrict access to the server by an IP address like dogmatic69 suggestion. using 127.0.0.1 if the database server is on the same server as the web server or use the IP address of the web server if the database server is on a different server.