Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
How to setup and connect my database to NodeJS application on digital ocean

I have managed to create a droplet on Digital-Ocean and managed to clone my Node JS app onto it. Locally , the app connects to MySQL database and I wanted to the same on the live version. Ignorantly, I attempted to create a Managed database cluster which I did and added 1 user account and created 1 database. Right now I do not know how I can import the exported database.sql file into the database since I am only used to phpMyAdmin.

How can I get this to work and connect to my NodeJS app?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You were using phpmyadmin as an interactive Mysql client program. It's easy to use but hard to set up because it's a web app.

Try another MySql client program. The command-line client, memorably named mysql, is a good choice.

Get a shell on your droplet, then say

sudo apt install -y mysql-client
mysql -u username -p -h databasehostname -D database
mysql> source database.sql
mysql> quit

You'll be prompted for your database password.

That should import your database.

The mysql command line program is very useful and worth some of your time to learn to use.

over 4 years ago · Santiago Trujillo Report

0

First, make sure your database cluster is not open to the outside world by adding a DB firewall using DigitalOcean databases. You can allow connections from your own droplet's private IP address, and your own public address (or VPN or however way you're set up). Once you've done that, you should be able to import your SQL file locally (or from the DO Droplet, as long as you have the mysql client installed):

mysql -h [host-provided-do] -P [port-provided-do] -u [username-provided-do] -p [db-name-provided-do] < my-file.sql

The most important thing is to make sure your managed database is not open to the outside world, and that you make sure it only allows incoming connections from known IP addresses.

In your NodeJS app, you can set the driver to connect to the private subnet that DO provides.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!