Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

connect to mysql from cloud via node.js aplication

Hello everyone, some days ago I send my sql database to the google cloud because I needed to use that database in another computer, that dont have this file locally, and that database is used to save data that im using to integrate with an express node.js aplication that imk using, and thats where the problem appeares. Im having real trouble trying to connect my sql from the cloud to my node.js aplication, I already had watched a lot of videos talking about it and I still cant resolve that problem. To be more especific, I cant connect the aplication cause, when I select, on the field 'socketPath:/cloudsql/name-of-my-instance' the aplication dont understand it. May any one help me ?🥺😢

0 1 453
1 REPLY 1

Hi @chicote444,

Welcome to Google Cloud Community!

I understand that you’re having trouble connecting your Node.js application to the database you moved to Google Cloud. Could you let me know how you transferred the SQL database to Google Cloud? This issue could be due to several factors.

Here is a list of possible workarounds that you can explore, which may help you identify the problem you’re encountering:

  • Connect using Connection name: Try using the connection name instead of the instance name, following the format project-id:region:instance-id
  • Try to understand Cloud SQL connectors: Cloud SQL connectors are now generally available, and you can include them with your application to securely connect to your database.
  • Connect using SQL Server Client or Cloud SQL Auth Proxy: These documentation may give you an idea of the different ways to connect your database to a Cloud SQL instance.
  • Check About connection options page: For more information about connecting to a Cloud SQL instance.
  • Plan your SQL server migration to Cloud SQL: This blog might provide insights into things to consider if you want to fully migrate your database to Google Cloud for future use.

If the above workarounds don’t work for you and if you have a support package, I recommend reaching out to Google Cloud Support for a more in-depth analysis. When contacting them, please provide comprehensive details and include screenshots. This will help them better understand and address your issue.

I hope the above information is helpful for you.

 

Top Labels in this Space
Top Solution Authors