Enable Remote Connection
Edit /etc/mysql/my.cnf
Basic Editing Options:
1. Less secure, most accessible: Comment out bind-address
2. More secure, less accessible: change bind to your server’s IP address
Save and exit.
$ sudo service mysql restart
Grant Access to your User
mysql> GRANT ALL ON database_name.* TO user@xx.xxx.xx.xx IDENTIFIED BY 'your_password';
Replace xx.xx.xx.xx with your local IP address of your laptop/desktop or if it is dynamic you can add them either by: ‘192.168.0.%’ as a dynamic C-class or ‘%’ if you want to be able to connect from anywhere (this is less secure)
Troubleshooting
ByPass the Firewall
sudo ufw allow 3306/tcp sudo service ufw restart
Comment out # skip-external-locking
# skip-external-locking
Test your remote access
mysql -h your_ddbb_server_ip -u your_user -p your_database_name