How to enable remote access to the database hosted on the droplet

Posted August 20, 2015 22.5k views

I’m trying to figure out how to enable database connection to the database on one of our droplets from the remote application. I believe the IP is the same as the droplet, but is the port also 3306 or any other?

Anything else that needs to be done to make it happen?

I tried by just using the default port (above), the ip address and right credentials for the given database, but no luck.

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.

Submit an Answer
3 answers

This tutorial includes a section on enabling remote connections in MySQL. By default the MySQL service only allows connections from localhost so some configuration changes and a user with permissions to access your databases from a remote host are required.

by Justin Ellingwood
When your site begins to get more visitors, you may have to think about how to handle the additional traffic. One easy way of doing this is to separate your database operations from your web server so that each can handle its own load. In this guide, we'll demonstrate how to do this for a WordPress site built on Nginx by configuring a remote MySQL database.

Thanks @ryanpq - I’ll follow this tutorial and see how I get on.

Tried this tutorial for adding IPs but my file at /etc/mysql/my.cnf does not have a section with [mysqld]

# The MySQL database server configuration file.
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
# For explanations see

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

where do I add

bind-address        = your_database_IP

and how do I add several IPs?