Hi,

I’ve been searching the net for the last few hours on the issue and tried almost everything I saw, but with no avail.

I created a wordpress site in DO using “OpenLiteSpeed WordPress 5.3 on Ubuntu 18.04” the one click option and I wanted to connect to the MySql db remotely. I want to create external windows app and fetch data from the database. I tested it by attempting to connect through my Navicat app (mysql interface) and telnet ip 3306, but connection failed.

As of the moment, here is what I have tried.

  1. Adding ufw allowing 3306 port, and then ufw enable. After hitting ufw status verbose, it shows that the port is already allowed.

  2. Adding Listeners to port 3306 in the OpenLiteSpeed portal.

  3. Running scripts in the phpmyadmin to GRANT ALLOW ALL PRIVILEGES the root user, and my custom user.

  4. Creating user to my phpmyadmin and allowing GRANT access to database.

After these, my results are:

  1. telnet to ip:port show Connection Failed.

  2. Unable to access through my navicat interface. (Also tried, Mysql Workbench).

Any help or any topics they can point me to is much appreciated.

Thanks

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.

×
2 answers

Hi there @jonasalmocera,

This sounds like that you have a firewall blocking the MySQL port. I believe that the OpenLiteSpeed WordPress image from the Marketplace comes with UFW enabled, so to allow access to port 3306 you can use the following command:

sudo ufw allow mysql

For more information on how to add and remove firewall rules, you can follow this tutorial here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-18-04

As a side note, I would strongly advise against opening access to MySQL for the world due to security reasons. What you could do instead is to use an SSH tunnel to connect to MySQL. Here’s how to do that with Workbench.

Hope that this helps!
Regards,
Bobby

by Brian Boucheron
This tutorial will show you how to set up a firewall with UFW on Ubuntu 18.04.
  • Hi @bobbyiliev ,

    I have already typed in:

    sudo ufw allow 3306
    

    but still I am unable to connect to the database. I already returns, duplicate rule is skipped. I also saw the one on which we can create an assh tunnel using the link you have provided, but the even in workbench I am unable to connect to my database using the SSH tunnel using the Workbench.

Adding Listeners to port 3306 in the OpenLiteSpeed portal.

don’t do this

Running scripts in the phpmyadmin to GRANT ALLOW ALL PRIVILEGES the root user, and my custom user.

Creating user to my phpmyadmin and allowing GRANT access to database.

make sure you set users can be access from remote , e.g.

root@123.123.123.123 , where 123 is your other IP

or

root@%

then edit your /etc/my.cnf , make sure it’s not bind to 127.0.0.1

Submit an Answer