How to Allow Remote MySQL Connection
Fix HeidiSQL connection issues by enabling external MySQL access in minutes.
Before you start
Step-by-step instructions
1. Create remote MySQL user
Create a user that can connect from any IP.
CREATE USER 'root'@'%' IDENTIFIED BY 'yourpassword';
2. Grant privileges
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
FLUSH PRIVILEGES;
3. Update bind-address
Edit MySQL configuration file.
vi /etc/mysql/my.cnf
bind-address = 0.0.0.0
4. Restart MySQL
service mysql restart
Common issues
Make sure firewall or cloud security allows MySQL port.
MySQL will still block external access if bind-address is 127.0.0.1.
User must be created with '%' to allow remote access.
About this guide
This guide shows how to allow remote MySQL access so you can connect from tools like HeidiSQL. By default, MySQL blocks external connections, so you need to update user permissions and configuration settings.
How to follow this guide
- Create a MySQL user that allows remote connections.
- Grant proper privileges to the user.
- Update MySQL configuration bind-address setting.
- Restart MySQL service.
- Check firewall and port settings if connection fails.
Why use this method?
Remote MySQL access allows you to manage your database from external tools like HeidiSQL, making development and server management much easier.
Frequently Asked Questions
Why is MySQL not accessible remotely?
MySQL blocks external access by default using bind-address and user host restrictions.
Is it safe to allow root remote access?
It is not recommended. Creating a separate user with limited privileges is safer.
What port does MySQL use?
MySQL uses port 3306 by default.
What if I still cannot connect?
Check firewall rules, cloud security groups, and ensure port 3306 is open.