mysql-events icon indicating copy to clipboard operation
mysql-events copied to clipboard

Custom ports wont work.

Open AltayAkkus opened this issue 4 years ago • 0 comments

const mysql = require('mysql');
const MySQLEvents = require('@rodrigogs/mysql-events');

const program = async () => {
  const connection = mysql.createConnection({
    host: 'localhost',
    user: 'root',
    password: 'root',
    port: 1337
  });

  const instance = new MySQLEvents(connection, {
    startAtEnd: true,
    excludedSchemas: {
      mysql: true,
    },
    port: '1337'
  });

  await instance.start();

  /*instance.addTrigger({
    name: 'TEST',
    expression: '*',
    statement: MySQLEvents.STATEMENTS.ALL,
    onEvent: (event) => { // You will receive the events here
      console.log(event);
    },
  });
  
  instance.on(MySQLEvents.EVENTS.CONNECTION_ERROR, console.error);
  instance.on(MySQLEvents.EVENTS.ZONGJI_ERROR, console.error);
  */
};

program()
  .then(() => console.log('Waiting for database events...'))
  .catch(console.error);

Produces

Error: connect ECONNREFUSED 127.0.0.1:3306 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) -------------------- at Protocol._enqueue (C:\Users\admin\node_modules\@rodrigogs\mysql-events\node_modules\mysql\lib\protocol\Protocol.js:144:48) at Protocol.handshake (C:\Users\admin\node_modules\@rodrigogs\mysql-events\node_modules\mysql\lib\protocol\Protocol.js:51:23) at Connection.connect (C:\Users\admin\node_modules\@rodrigogs\mysql-events\node_modules\mysql\lib\Connection.js:116:18) at C:\Users\admin\node_modules\@rodrigogs\mysql-events\lib\connectionHandler.js:6:75 at new Promise (<anonymous>) at connect (C:\Users\admin\node_modules\@rodrigogs\mysql-events\lib\connectionHandler.js:6:31) at connectionHandler (C:\Users\admin\node_modules\@rodrigogs\mysql-events\lib\connectionHandler.js:42:11) at MySQLEvents.start (C:\Users\admin\node_modules\@rodrigogs\mysql-events\lib\MySQLEvents.js:88:29) at program (C:\Users\admin\Documents\GitHub\mhkdbmirror\test.js:21:18) at Object.<anonymous> (C:\Users\admin\Documents\GitHub\mhkdbmirror\test.js:37:1) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 3306, fatal: true }

It tries to connect to the Port 3306, even though I said that it should use port 1337. Have found no documentation here or at ZongJi, I am slowly starting to lose my mind :D (1337 as a string or integer does not work either, I tried everything thats possible. Entering the port parameter into the new MySQLEvents which is passed to ZongJi does not work either.)

AltayAkkus avatar Jan 06 '21 17:01 AltayAkkus