I
I
Ingerniated2017-05-26 13:30:03
Node.js
Ingerniated, 2017-05-26 13:30:03

Why can't connect to mysql?

I installed the mysql package, did everything according to the instructions, but

const http = require('http');
const mysql = require("mysql");

const connection = mysql.createConnection({
  host : "localhost",
  user : "root",
  password : "password"
});

connection.connect(function(e) {
  if(!!e) {
    console.log(e);
  }
  else {
    console.log("Connected");
  }
});


http.createServer(function (req, res) {
  res.write('Hello World!'); 
  res.end();
}).listen(8080);

a233a8e460c14cc4985b9ed25af4974c.jpg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question