Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.1K
Visualizações
error : connect ECONNREFUSED

I am running a node app with mysql as my database(also using sequelize as ORM). Whenever I run the "app.js" file with "node" command, I get an error:

{ [Error: connect ECONNREFUSED 127.0.0.1:3306] code: 'ECONNREFUSED', errno: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 3306, fatal: true }

my code in the app.js file:

var  mysql = require("mysql");

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

connection.connect(function(err){
  if(err){
    console.log(err);
  } else {
    console.log("no errors");
  }
});
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I probably should have mentioned before hand, but I am using cloud9 to for my node environment. Cloud9 has some things setup for you already:

  1. Your "host" to connect to will just be "localhost".
  2. "user" will be your cloud9 username.
  3. "password will be left blank.
  4. "database" will be "c9"

 var connection = mysql.createConnection({
  host: "localhost",
  user: "seth40047",
  password: "",
  database: "c9"
});
https://community.c9.io/t/setting-up-mysql/1718 This article is very helpful for anyone who is also having troubles setting up MySql on a cloud9 node environment.

over 4 years ago · Santiago Trujillo Relatório

0

I had the same issue trying to connect node to a database in Cloud9. he fix was to

run the database and node in the same Cloud9 workspace.

Though this might be obvious to more experienced coders, I wrongly thought that I had the two workspaces communicating.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda