Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom ports wont work. #32

Open
AltayAkkus opened this issue Jan 6, 2021 · 0 comments
Open

Custom ports wont work. #32

AltayAkkus opened this issue Jan 6, 2021 · 0 comments

Comments

@AltayAkkus
Copy link

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.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant