Allowing remote access to MySQL safely
Connect to your server's database from another machine.
The safest way is an SSH tunnel, which doesn't open the database to the internet:
ssh -L 3307:127.0.0.1:3306 root@203.0.113.10
# then connect your tool to 127.0.0.1:3307If you must open MySQL directly:
- Set
bind-address = 0.0.0.0in the MySQL/MariaDB config and restart it. - Create a user allowed only from your IP:
CREATE USER 'app'@'198.51.100.7' IDENTIFIED BY '…'; - In IDX Panel's firewall, allow port 3306 only from that IP.
Never open port 3306 to everyone. Database ports are a top target for attacks.
On cPanel hosting, use Remote MySQL in cPanel to allow your IP address.