Hi All,
I’m trying to remotely connect to MySQL which has been installed on an Ubuntu VM in Digital Ocean. I have edited the my.cnf file as described on the MariaDB website
bind-address = VM ip address
Ran this command in MySQL within the VM
GRANT ALL PRIVILEGES ON . TO ‘root’@‘VM IP ADDRESS’ IDENTIFIED BY ‘MY PASSWORD’ WITH GRANT OPTION;
& added the database URL within J-Meter as follows
jdbc:mysql://ipofVM:3306/sakila
However, when I run the JMX file I cannot get a connection to the VM in Digital Ocean
Any suggestions please?
Thanks Del.
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.
Hi!
As you are connecting from your computer, you will need to allow it to connect to MySQL, which means that the command should look like
... 'root'@'1.2.3.4' ...
instead, where 1.2.3.4 is your local computer’s public IP address.However, exposing your MySQL server to the public is a bad idea. Instead, configure MySQL to listen on and allow logins from
localhost
only. Then, use your SSH client to set up an SSH tunnel that forwards port 3306 on your computer to port 3306 on your Droplet. As you’re connecting via the tunnel, the connections appear to MySQL as if they’re coming from inside the Droplet itself.Once you’ve done that, you should be able to have JMeter connect to MySQL at
localhost:3306
and the connection will be tunneled to your Droplet, allowing you to securely access your MySQL server from your computer.