I have tried to connect MySQL to javascript.
I install homebrew for node.js.
I have never used node.js before so I didn't know how to install it.
I installed homebrew on my Mac before.
I reset my Mac so I have to install homebrew again.
I simply follow the instruction in the link above. There were some errors after installation. I googled that error, and there were many solutions but any of them worked in my case.
Then someone said just restart the terminal and try again. It worked!
Then I install npm(node.js package manager) which I never heard it before.(I always realize I'm so naive. There are so many things I have to learn. I have to study harder!)
npm i -g mysql
It occured some errors, I didn't read carefully but I thought errors about authority. So I ran with the 'sudo' command.
Then I add some lines in build.gradle.
implementation 'mysql:mysql-connector-java'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
https://defineall.tistory.com/709
Then I write code to connect to MySQL following the instructions in the link above!
I added one more line to see if the connection success or not.
After running, I got an error message.
"Uncaught SyntaxError: Cannot use import statement outside a module"
It's an error from this line.
import mysql from 'mysql';
I want to see MySQL connection success before I go to bed, but life is not that easy. TT
Let's fix it tomorrow!