How does one connect an Android app to a remote database?

The question should make it clear. I’ve got a local database running and in the editor it works perfectly, but now I wonder how to make it connect to a remotely hosted database.

Here is the code I use to make it connect:

    private static void openSqlConnection()
    {
        string connectionString = "Server=localhost;" +
            "Database=pokedex;" +
            "User ID=root;" +
            "Password=;" +
            "Pooling=false";
        dbConnection = new MySqlConnection(connectionString);
        dbConnection.Open();
        Debug.Log("Connected to database.");
    }

I get that User ID and Password would be the user and pass to the database, but I don’t know what to fill in in the Server spot. I’ve practiced a little bit of PHP and with that a database always is on localhost, since usually the PHP files are also on that same server.

But since I’m making an Android app, the database will not be local, but hosted somewhere else. Could anyone give me a clear idea of where I should look? (I’ve been looking all over the internet, but I can’t find anything remotely helping)

Well, I don’t know if an Android device will have any problems or not directly acessing a MySQL database, I would surely put a webservice layer between the game and the database, but answering to your question, you should put the IP or the URL to the server where the MySQL engine is hosted. Also, the MySQL ports in the server should be open and correctly accepting external requests.

Still, not sure if Android would require anything security-wise to allow you to remotely access ports rather than 80, you would have to check this out too.