connect ECONNREFUSED - node js , sql

前端 未结 3 1203
走了就别回头了
走了就别回头了 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:49

    I got this error when MySQL Server was not running.

    I changed my configuration via Initialize Database in MySQL.PrefPane, the System Preferences tool for MySQL on OS X - to Use Legacy Password Encryption - to fix ER_NOT_SUPPORTED_AUTH_MODE. This config change stopped MySQL Server and then I got ECONNREFUSED when I tried to connect to MySQL from node.js.

    Fixed by restarting MySQL Server from the MySQL System Preferences tool.

提交回复
热议问题