我正在尝试将我的自定义 mysql 数据库连接到 Auth0。但我收到以下错误
[错误] ECONNREFUSED - 连接 ECONNREFUSED 127.0.0.1:3306
我的代码是,
function create (user, callback) {
var connection = mysql({
host : 'localhost',
user : 'db_user',
password : 'db_password',
database : 'db_name'
});
connection.connect();
var query = "INSERT INTO users SET ?";
var insert = {
password: bcrypt.hashSync(user.password, 10),
email: user.email
};
connection.query(query, insert, function (err, results) {
if (err) return callback(err);
if (results.length === 0) return callback();
callback(null);
});
}