connect ECONNREFUSED - node js , sql

前端 未结 3 1201
走了就别回头了
走了就别回头了 2020-11-28 15:24

I have the next code in a js file:

var mysql = require(\'mysql\');
var TEST_DATABASE = \'nodejs_mysql_test\';
var TEST_TABLE = \'test\';
var         


        
3条回答
  •  旧巷少年郎
    2020-11-28 15:46

    I know two ways to solve it:

    1. In mysql.conf, comment skip-networking.

    2. Try to set the socket like this:

      var client = mysql.createClient({
      user: uuuu,
      password: pppp,
      host: '127.0.0.1',
      port: '3306',
      _socket: '/var/run/mysqld/mysqld.sock',});
      

提交回复
热议问题