This is a short an simple tutorial on how to enable remote access on MySQL on Ubuntu/Debian:
- Edit the file /etc/mysql/my.cnf: at the line with: bind-address = …
- Replace 127.0.0.1 with your server’s IP address.
- Save the file!!!
- Log in to MySQL: mysql -u root -p
- Run command: GRANT ALL PRIVILEGES ON *.* TO ‘MY_USERNAME’@’18.104.22.168‘ IDENTIFIED BY ‘MY_PASSWORD’;
- Restart the MySQL server with the command: sudo /etc/init.d/mysql restart or restart mysql
*.* = (star point star) all databases, all tables
‘MY_USERNAME’ = the user to whom you wish to grant access
‘22.214.171.124’ = the IP from where you will connect (for any IP use: ‘%’ )
‘MY_PASSWORD’ = the password of the user to whom you are granting access