1 Answer

Hey friend!

Let's simplify all of this a bit with a theoretical scenario:

  • MySQL is on server 1.1.1.1.
  • I need server at 2.2.2.2 to connect to database "digitalocean" on 1.1.1.1.

On server 1.1.1.1 I make sure that bind-interface is set to 0.0.0.0. I check this with "netstat -tulpn" to make sure MySQL isn't just listening on 127.0.0.1. If it is, then I haven't set bind-address, and need to work on that before continuing. Otherwise, I continue by running this in MySQL shell on 1.1.1.1:

create database digitalocean;

Then:

grant all on digitalocean.* to 'jarland'@'2.2.2.2' identified by 'mypassword';

Now on 2.2.2.2 I run:

mysql -h 1.1.1.1 -u jarland -pmypassword digitalocean

Then I should have a MySQL shell. If I don't, and no firewall is blocking port 3306 outbound on 2.2.2.2 or inbound on 1.1.1.1, I didn't do one of the above steps.

Jarland

Have another answer? Share your knowledge.