Cannot connect to MySql in .Net

Hi, I cannot seem to connect to MySql client from my c# code.

I have my connectionString

var connectionString = new MySqlConnectionStringBuilder()
{
Server = public ip address of instance,
UserID = user id,
Password = password,
Database = databaseName,
};

This always results in timeouts.

Is there a way to connect to mysql using google credentials? similar to here https://stackoverflow.com/questions/73078590/google-spanner-execute-a-query-using-custom-credentials/73079692#73079692 ?

Edit: We are ip whitelisting and dev environment can’t be added to the list, so I need to use service account
Edit: Got it done through Cloud Sql Proxy

Hi. irida

There may be many reasons. Check whether the network is assigned to the Authorized networks in Instance > Connections > NETWORKING.