Join us on Facebook!
— Written by Triangles on December 24, 2016 • updated on November 10, 2019 • ID 46 —
How to allow remote connections from any host to your MySQL server.
This MySQL walkthrough is designed for any Debian-based distribution.
Step 1: open /etc/mysql/my.cnf
.
Step 2: comment out the bind-address
line, which tells MySQL where to listen. If you remove it, MySQL will accept any connection. You could also assign an IP address like bind-address = <ip-here>
if you wish to give access to a specific machine. Comment it out otherwise.
Step 3: restart the mysql
service with sudo service mysql restart
.
Step 4: finally, grant permission to MySQL users from any host:
GRANT ALL PRIVILEGES ON *.* TO <your-user-here>@'%' IDENTIFIED BY '<user-password-here>';
FLUSH PRIVILEGES;
Done!
MySQL - MySQL 5.7 Reference Manual: Server Command Options (link)