Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
100 views
in Technique[技术] by (71.8m points)

node.js - Connecting Nodejs with Mysql

I was trying to connect nodejs with mysql(first time).i am following w3schools. Before running the below code i have installed ('npm install mysql').And the website mentioned ou can download a free MySQL database and Once you have MySQL up and running on your computer, you can access it by using Node.js.

i have installed mysql ,but how to start and run it in windows,please help.


var con =mysql.createConnection({
    host:"localhost",
    user:"root",
    password:" "
});

con.connect(function(err) {
    if(err) {
        console.log("Error")
    }
    else
    console.log("Connected!");
});
question from:https://stackoverflow.com/questions/65860182/connecting-nodejs-with-mysql

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...