Download and install DBeaver from here.
Make sure to access your server via SSH before continuing.
To execute SQL code in the server run
We need a new user to access the database. We can create one by running
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'droplet_ip_address' IDENTIFIED BY 'password';
DON'T COPY PASTE THE ABOVE CODE! 'password' IS NOT A REAL PASSWORD! CHANGE 'admin', 'droplet_ip_address' AND 'password'!
SSH into your DigitalOcean droplet. Inside your droplet, remove (comment) the bind address of 127.0.0.1:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 127.0.0.1
# bind-address = 127.0.0.1
Open DBeaver workbench and initialize a new connection:
Your default connection settings should look like this:
Under Authentication (Database Native) type in the credentials of the user we created on top (I created a user called 'admin').
For SSH, set the authentication method to "Public Key" and under "Private Key" search for the private key associated with your droplet. Your passphrase was asked for when you created the key (or when you converted the key to RSA format).
Test the connection. If you connected successfully you should see the following: