I have nodejs project with xampp serving local database (mysql/mariaddb) for local development target. And a custom remote host (VPS) setup with nodejs /nginx /mariadb -phpmyadmin access as a remote target.
Local target works fine with its localhost database connection. But remote target development server is not communicating with its localhost mysql/mariadb on remote host.
Both local target and remote target databases are hosted on localhost:3306 and both has same database and users with tables and data.
I turned on server connect debug and ran published to server and ran the nodejs app ( after a bit of troubleshooting) reached following error;
server-connect:server Got error? Error: connect ECONNREFUSED ::1:3306
server-connect:server at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1157:16)
server-connect:server --------------------
server-connect:server at Protocol._enqueue (/var/www/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
server-connect:server at Protocol.handshake (/var/www/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
server-connect:server at Connection.connect (/var/www/app/node_modules/mysql/lib/Connection.js:116:18)
server-connect:server at /var/www/app/node_modules/knex/lib/dialects/mysql/index.js:66:18
server-connect:server at new Promise ()
server-connect:server at Client_MySQL.acquireRawConnection (/var/www/app/node_modules/knex/lib/dialects/mysql/index.js:61:12)
server-connect:server at create (/var/www/app/node_modules/knex/lib/client.js:247:39) {
server-connect:server errno: -111,
server-connect:server code: ‘ECONNREFUSED’,
server-connect:server syscall: ‘connect’,
server-connect:server address: ‘::1’,
server-connect:server port: 3306,
server-connect:server fatal: true
server-connect:server } +0ms
While this could be due to one of many reasons, I would like to know if there is a deferent approach that would not result in all these troubles. I would like my app on web host to connect to local database on the same host without docker. I guess this should be a simple matter of right configurations. I appreciate any help on this given the word ‘docker’ is not used. :)…
Last updated: