-2

I wanna connect to my database. Im using a node.js server with a mysql database. Localhost works, but when I try to connect to my database I get this error: getaddrinfo ENOTFOUND

const pool = mysql.createPool({
  connectionLimit: 10,
  password: "****",
  user: "***",
  host: "***",
  port: "3306",
  database: "***",
});

as I said - with localhsot settings it works but when i fill it out with my ionos credentials it will not work

1 Answers1

0

You mentioned in the comments above that your database is hosted by IONOS, and your code is running externally from there.

Unfortunately, IONOS appears to block connections to their database products from external sources. Heroku is most definitely an external source. This fact is clearly documented on their help site:

Access to your IONOS MySQL database from your desktop computer or any other non-IONOS source is not possible:

In principle, you can only access your MySQL database through applications installed on your IONOS web space, e.g. with your own WordPress installation. Other access paths have been blocked for security reasons.

The way they accomplish this restriction is likely by not publishing public DNS records for their databases, which is why your code complains about not being able to resolve an address for it.

What you're asking for is not possible with this vendor without a special arrangement. If this is an absolute requirement, you should look for an alternative database host.

esqew
  • 42,425
  • 27
  • 92
  • 132
  • Now i tried it with a World4You Database. Here I get a "PROTOCOL_SEQUENCE_TIMEOUT" error – Prodesign Webprojekte Apr 30 '21 at 15:33
  • I would recommend reviewing the documentation for the database providers you're selecting before actually selecting them. I've never heard of "World4You", but [*their* documentation](https://www.world4you.com/faq/en/webhosting/faq.pc-mysql-datenbank.html) also *clearly* mentions this is not possible. – esqew Apr 30 '21 at 15:37
  • okey - but what should i do? is there a provider who supports this issue? – Prodesign Webprojekte Apr 30 '21 at 15:45
  • There are plenty of providers - you could even run your own instance on your own server. Personally all my database are hosted using Microsoft’s Azure SQL product. Unfortunately, requests for product/service recommendations are off-topic for Stack Overflow. – esqew Apr 30 '21 at 16:00