I need external connection to MySQL. Using Plesk/Ubuntu 16/nginx. In firewall policy the port 3306 is allowed from any IP.
Is it somewhere else where it shall be allowed? If so, what file is needed to be edited?
I need external connection to MySQL. Using Plesk/Ubuntu 16/nginx. In firewall policy the port 3306 is allowed from any IP.
Is it somewhere else where it shall be allowed? If so, what file is needed to be edited?
2
Answers
netstat result:
You have to make changes to MySQL configuration, and allow remote access for the user.
1. Open MySQL configuration file. For RHEL-based distributions –
/etc/my.cnf
, for Debian-based –/etc/mysql/my.cnf
.2. Change
bind-address
parameter tobind-address = 0.0.0.0
and make sure thatskip-networking
parameter is not defined.3. Restart MySQL daemon:
Or:
Or:
The service name depends on the installed MySQL version. You can do all three if you are not sure. It will do no harm unless the error was made in
my.cnf
.4. Grant the access to remote IP address and login to MySQL. For example, if you want to allow access to database called
database
for useruser
with passwordpassword
and remote IP address203.0.113.2
:To create a user that has access to all databases, execute the following query:
5. You can verify that MySQL server is listening on the correct IP address using
netstat
. Here is the desired output –0.0.0.0
address: