Remote database connection and local development

In most cases, the database server is not open to remote connections by default, meaning that you can connect to it locally (web server and database server are on the same machine). By default, MySQL is binding to the localhost or 127.0.0.1. Here is one tutorial on how to grant remote access to specific IP and user account: Enable Remote Access for MySQL.