![]() Then, select the Database that you want to access remotely. On the Remote MySQL page, type the IP address of your remote server in the IP (IPv4 or IPv6) field or tick the Any Host box to connect from any IP. To start the process, log in to your hPanel and navigate to Databases -> Remote MySQL. If you use Hostinger, you can connect to the MySQL server remotely by allowing an IP address on your account’s side. The output will look similar to this: Connection to mysql_server_ip 3306 port succeeded! How to Allow Remote Connections to MySQL Database Server on hPanel The -p parameter will prompt you to enter the password for the MySQL user account. Replace the username with your MySQL username and mysql_server_ip with the IP address or hostname of the MySQL server. Try running the MySQL server to establish a connection from your remote system by typing the command below: mysql -u username -h mysql_server_ip -p Now the server will allow remote connections to your MySQL service. Once you’re finished, save the iptables configuration by entering: service iptables save Remember to change remote_IP_address to the IP address of the remote host. ![]() Note that the command above will allow remote access from all IP addresses on the internet through the MySQL port.Īlternatively, you can grant access to a remote user from one specified IP address with the following command: iptables -A INPUT -i eth0 -s remote_IP_address -p tcp If iptables is your default firewall tool, execute the following command to open port 3306 for unrestricted traffic: iptables -A INPUT -i eth0 -p tcp -destination-port 3306 -j ACCEPT If you have configured a firewall service on the MySQL server, you need to allow traffic through this specific port. The default MySQL port for external connections is 3306. This line makes the system not listen for TCP/IP connections at all.Īfter editing the file, save it by pressing CTRL+X or COMMAND+X if you are on Mac.įor changes to take effect, restart the MySQL service by running the following command: systemctl restart mysqld 2. ![]() If there is a line containing skip-networking, make sure to delete it or mark it as a comment by adding # at the beginning. Remember to replace with the specific IP address of the remote machine to which the MySQL server should listen. Once the file opens, locate the line that contains label and add the following code: bind-address= Then, open and edit the MySQL config file using the nano editor: nano /etc/my.cnf To do this, log in to your server as the root user and run the following command to determine the location of the MySQL configuration file: mysql -help | grep "Default options" -A 1 The first step is to make the remote MySQL server listen for external connections by adding an extra option to the configuration file. ![]() Changing the MySQL Server Configuration File If you are a Hostinger VPS hosting user, find the login details on the hPanel’s VPS → SSH access tab or use the integrated Browser terminal: 1. Note that you’ll need to establish an SSH connection if the server is outside your data center by using PuTTY on Windows or the built-in terminal shell on Linux and macOS.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |