Unable to access database from Google Cloud MySql account using Microsoft Visual Studio C#

JC 1 Reputation point
2021-11-15T04:41:02.37+00:00

I have been trying to access a MySQL database I created in Google Cloud for creating an Android app using C# in MS Visual Studio. It neither retrieves (or adds to) any of my data from my Google cloud MySQL database nor does it return any errors or suggestions to improve my connection string statement.

The connection string format in my code is as below:

public static string connectionString = "server=name of my server;port=port number;user=user name;password=password;database=name of database;";

Is the above syntax correct, or am I missing anything? Also, is it connection name or is it public IP address I use for server name?

Thanks in advance for your help.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
8,588 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Seeya Xi-MSFT 12,821 Reputation points Microsoft Employee
    2021-11-15T06:16:02.753+00:00

    Hi @JC ,

    Welcome to Microsoft Q&A!

    Your problem does not seem to be related to sql server, but rather more seems to be related to Google Cloud.
    I tried to solve your problem and here are the links that I think might help you.
    https://stackoverflow.com/questions/56503352/how-do-i-connect-to-my-google-cloud-sql-instance-with-c/56503446
    https://stackoverflow.com/questions/52457709/how-to-connect-google-cloud-sql-with-c-sharp

    Also, is it connection name or is it public IP address I use for server name?

    Server = "Google Cloud SQL IP address"

    Here is the Google Cloud Support i find from google:
    https://support.google.com/googlecloud/?hl=en

    Best regards,
    Seeya


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments