var mysql = require('mysql');
var connection = mysql.createConnection({
host : 'localhost',
user : '',
password : '',
database : 'mejili'
});
connection.connect();
connection.query('SELECT * FROM cards where number = 1', function(err, rows, fields) {
if (!err)
console.log('The solution is: ', rows);
else
console.log('Error while performing Query.');
});
我搜索了很多,我仍然无法找到一种方法只通过js连接数据库,而不是使用节点。