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
2.7k views
in Technique[技术] by (71.8m points)

mac node运行mysql语句卡住

image.png
BF821A63-55FA-4102-B9D2-9C16A28FA34D.png


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

1 Answer

0 votes
by (71.8m points)

那不叫卡住,那叫主进程没退出。而且你的写法也有问题,你这样写什么都查不出来,sql连接瞬间开启关闭,顺便帮你改一下吧

dbConnect.query(_sql, (err, res)=> {
    if (err) {
        console.log(err)
        process.exit(1)
    } else {
        console.log(res)
        process.exit()
    }
})

你自己去查下js的运行原理和nodejs的process.exit吧


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

2.1m questions

2.1m answers

60 comments

57.0k users

...