By default, MySQL only accepts connections from localhost. Here's how to enable remote access securely.
1. Configure MySQL
Edit /etc/mysql/mysql.conf.d/mysqld.cnf:
bind-address = 0.0.0.02. Create Remote User
CREATE USER 'remoteuser'@'%' IDENTIFIED BY 'StrongPassword!';\nGRANT ALL PRIVILEGES ON myapp.* TO 'remoteuser'@'%';\nFLUSH PRIVILEGES;For better security, replace % with a specific IP:
CREATE USER 'remoteuser'@'203.0.113.50' IDENTIFIED BY 'StrongPassword!';3. Open Firewall
ufw allow from 203.0.113.50 to any port 33064. Restart
systemctl restart mysqlSecurity Warning
Never expose MySQL to the entire internet. Only allow specific IPs that need access.