S.Etinger
S.Etinger

Reputation: 35

Can someone please explain to me where do I get the properties to connect to an sql database from google cloud?

I want to know how to connect to an SQL database created on google-cloud-SQL.

I'm a real novice with SQL and MySQL so I don't really know a lot about it. I need it for a project of mine.


const connection = mysql.createConnection({
    host: '/cloudsql/projectid:us-central1:sql-instance',
    user: '',
    password: 'root'
})

where do i find/get the properties in the code above for me to connect to the sql database

Upvotes: 0

Views: 46

Answers (1)

John Hanley
John Hanley

Reputation: 81346

The quick answer is that you cannot. You will need to contact the admin to get the database user name and password. If you are the admin and you lost the password you can change it for a database user.

You can manage Cloud SQL users in the Google Cloud Console. Review to this document.

Don't forget that you will also need to whitelist your IP address if you are using IP based connections. I recommend using the Cloud SQL Proxy as this is safer and easier to setup.

Upvotes: 1

Related Questions