Cannot read property 'query' of undefined

当mysql连接js文档最后一行为exports.query = query,就报throw err; // Rethrow non-MySQL errors ^ TypeError: Cannot read property 'query' of undefined 求解

img

img

当把图一最后一行为module.exports= query,就报db.query is not a function

试试把密码不写root,直接password:""