I have written a Node.Js Application for demo purpose to connect to DB. I ma new to DO platform and connecting remote servers. The Node.Js application that I have written, I am able to connect to MySQL DB (present/using Managed DB Cluster provided by DO.) The logic is same, connection string details different. But, that same Node.Js application is unable to establish a connection to the MySQL present on the same ubuntu machine. I have taken a LEMP stack on Ubuntu. On, the LEMP stack ubuntu machine. I have PhpMyAdmin also which is working fine. In addition to LEMP, I have Node installed on the same Ubuntu Virtual Machine. This Node.Js application is unable to establish a connection to the MySQL which is a part of LEMP on this Ubuntu machine. But, the node.js application is able to establish connection to MySQL Managed DB Cluster.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
If you are connecting to the local MySQL installation, you need to try the following:
127.0.0.1
so that the Node.js service would connect to the MySQL service locally rather then via the public interfaceIf this is still not working, can you share the exact error that you are getting and also the connection string that you are using? Make sure to remove any sensitive information before sharing the connection string here.
Best,
Bobby