Full-Stack Deployment with Database

Hi,

I want to deploy my full-stack application with a client, server, and mysql database. So far, I have successfully deployed the client, which is a static site. Now, I’m having problems with deploying the server, which is a web service. When I deploy it, I get this error over and over again:

Running ‘npm start’

May 24 12:48:48 AM

May 24 12:48:48 AM> server@1.0.0 start

May 24 12:48:48 AM> node index.js

May 24 12:48:48 AM

May 24 12:48:51 AMConnectionRefusedError [SequelizeConnectionRefusedError]: connect ECONNREFUSED 127.0.0.1:3306

May 24 12:48:51 AM at ConnectionManager.connect (/opt/render/project/src/server/node_modules/sequelize/lib/dialects/mysql/connection-manager.js:92:17)

May 24 12:48:51 AM at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

May 24 12:48:51 AM at async ConnectionManager._connect (/opt/render/project/src/server/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:222:24)

May 24 12:48:51 AM at async /opt/render/project/src/server/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:174:32

May 24 12:48:51 AM at async ConnectionManager.getConnection (/opt/render/project/src/server/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:197:7)

May 24 12:48:51 AM at async /opt/render/project/src/server/node_modules/sequelize/lib/sequelize.js:305:26

May 24 12:48:51 AM at async MySQLQueryInterface.tableExists (/opt/render/project/src/server/node_modules/sequelize/lib/dialects/abstract/query-interface.js:102:17)

May 24 12:48:51 AM at async Users.sync (/opt/render/project/src/server/node_modules/sequelize/lib/model.js:939:21)

May 24 12:48:51 AM at async Sequelize.sync (/opt/render/project/src/server/node_modules/sequelize/lib/sequelize.js:377:9) {

May 24 12:48:51 AM parent: Error: connect ECONNREFUSED 127.0.0.1:3306

May 24 12:48:51 AM at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16) {

May 24 12:48:51 AM errno: -111,

May 24 12:48:51 AM code: ‘ECONNREFUSED’,

May 24 12:48:51 AM syscall: ‘connect’,

May 24 12:48:51 AM address: ‘127.0.0.1’,

May 24 12:48:51 AM port: 3306,

May 24 12:48:51 AM fatal: true

May 24 12:48:51 AM },

May 24 12:48:51 AM original: Error: connect ECONNREFUSED 127.0.0.1:3306

May 24 12:48:51 AM at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1605:16) {

May 24 12:48:51 AM errno: -111,

May 24 12:48:51 AM code: ‘ECONNREFUSED’,

May 24 12:48:51 AM syscall: ‘connect’,

May 24 12:48:51 AM address: ‘127.0.0.1’,

May 24 12:48:51 AM port: 3306,

May 24 12:48:51 AM fatal: true

May 24 12:48:51 AM }

May 24 12:48:51 AM}

Is this an issue where I have to change my database in my project? Or do I have to create something else to run my mysql database?

Hi,

It looks like you’re trying to connect to MySQL on localhost/127.0.0.1 - ECONNREFUSED 127.0.0.1:3306. Services like databases wouldn’t be on localhost/127.0.0.1, they had their own hostname, e.g. Render Postgres databases

In addition, Render doesn’t currently offer managed MySQL instances. However, it’s possible to host your own on Render if you’re comfortable with installing and configuring MySQL, along with the ongoing maintenance, e.g., security updates, authentication controls, taking backups, etc. This would also have a cost (likely starting around $27.50 USD per month), as it would require a “Standard” instance type Private Service, along with a disk.

If you’re looking for a managed MySQL server, you may want to look to another provider for that service and connect to it from your Render service.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.