快速js连接池不适用于远程mysql服务器

时间:2019-10-14 10:07:53

标签: node.js express

当我尝试与远程mysql服务器连接时,它将无法连接

{“错误”:true,“消息”:“发生错误错误:连接ETIMEDOUT”}

,但可与本地mysql服务器一起使用。

有人对此问题有解决方案吗?

以下是一些相关代码:

var pool = mysql.createPool({
  connectionLimit: 1000,
  acquireTimeout: 1000,
  timeout: 1000,
  host: 'remotemysqlserver.net',
  port: '3346',
  user: 'jone',
  password: 'jone123',
  database: 'test',
  debug: true,
  multipleStatements: true
});

但是像这样

var connection = mysql.createConnection({

  host: 'remotemysqlserver.net',

  user: 'jone',

  password: 'jone123',

  database: 'test',

});

0 个答案:

没有答案