18/03/2021 - nodejs mysql cloud database
1. google cloud console, google cloud trial and create test app
2. google cloud sql console, get credentials
3. installing mysql, create connection in workbench and test queries
4. npm mysql and creating mysql connection and queries for nodejs server
5. resources - nodejs mysql, sql queries
you need to activate the google cloud free trial, create a test app
go to google cloud console and click the dropdown
create new project
go to google cloud sql console
https://console.cloud.google.com/sql
create/choose an app>create instance>choose btwn mysql etc
click button to enable engine api
...
set user password, click button to create instance
white list your public ip address (google what's my ip address). click save
you need mysql community server
https://dev.mysql.com/downloads/mysql/
credentials
https://cloud.google.com/sql/docs/mysql/admin-tools#workbench
choose a name, separators only underscore
from credentials: hostname, username,password
click test connection
go to workbench>home>open the connection.
it will open new tabs and you can craft your queries here
mysql and nodejs
npm package here
https://www.npmjs.com/package/mysql
traversy media tutorial for nodejs and mysql
https://www.youtube.com/watch?v=EN6Dx22cPRI
you can see my code here
https://github.com/wly185/node-mysql-hosted-4
freecodecamp/giraffe academy's excellent tutorial on SQL
https://www.youtube.com/watch?v=HXV3zeQKqGY
i wish having a remote sql db it was as easy as mongodb atlas where it is already cloud based and you just grab the connection string and good to go
Comments