Airzero Cloud

Next Generation Cloud !

In this blog, we will look at how to enable remote access to a MySQL database on an Ubuntu machine.

  • In the MySQL Configuration file, allow connections from clients other than localhost.

In the configuration file, allow MySQL connections from other clients. The MySQL configuration file will be located in the /etc/mysql/mysql.conf.d directory and will be named mysqld.cnf. MySQL is configured by default to accept connections only from localhost, i.e. 127.0.0.1; we must change this to 0.0.0.0 to allow connections from other clients.

Change,

bind-address = 127.0.0.1

to

bind-address = 0.0.0.0
  • In the Ubuntu Machine's firewall, whitelist the client’s IP address.

The Ubuntu machine includes the Ubuntu Firewall, which by default does not permit incoming connections to MySQL port 3306. As a result, we must open the port for the client's specific IP address or, if your client does not have a fixed IP address, for all IP addresses.

Assume your client has the IP address 50.75.120.81. The following line on your terminal will enable incoming connections to port 3306 from a client with the IP address 50.75.120.81:

ufw allow any port 3306 from 50.75.120.81

If your client does not have a fixed IP address or if you need to allow all IP addresses (not recommended as anyone can attempt to connect to 3306),

ufw allow 3306

If you have any questions about How to Enable Remote MySQL Database Access on an Ubuntu Machine. Please do not hesitate to contact us. Your digital partner will be Airzero cloud.

Airzero Cloud is a fantastic web hosting service provider with an array of powerful tools. We will assist you in growing your business.

Email id: [email protected]

enter image description here

Author - Johnson Augustine
Cloud Architect, Ethical hacker
Founder: Airo Global Software Inc
LinkedIn Profile: www.linkedin.com/in/johnsontaugustine/