//连接数据库 var mysql = require('mysql'); var connection = mysql.createConnection({ host: 'bdm253137448.my3w.com', //数据库地址 user: 'bdm253137448', //数据库用户名 password: 'muchengfeng123', //数据库管理密码 database:'bdm253137448_db', //数据库名称 insecureAuth: true }); connection.connect(function(err) { if (err) { console.error('error connecting: ' + err.stack); return; } console.log('connected as id ' + connection.threadId); }); var userDelSql = 'DELETE FROM userinfo WHERE id = 3'; //删除 connection.query(userDelSql,function (err, result) { if(err){ console.log('[DELETE ERROR] - ',err.message); return; } console.log('-------------DELETE--------------'); console.log('DELETE affectedRows',result.affectedRows); console.log('&&&&&&&&&&&&&&&&&'); }); //关闭连接 connection.end();