How to Allow Remote Connections for MySQL Server

By | April 4, 2019

Sometimes you need to connect to MySQL server from different locations. In this case you need to set up the server so it could accept such requests. In order to do that, you have to add a single string in your MySQL config file.

First of all, we need to find the location of my.cnf file.

mysql --help | grep cnf

Most probably, your output will look like

/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf order of preference, my.cnf, $MYSQL_TCP_PORT,

So you have to take the first option, in our case it’s my.cnf. If this file does not exist, you will have to create it.

You will have to add a single line (or replace the existing one)

bind-address=0.0.0.0

Now save the configuration file and reboot your MySQL server – you should be able to accept remote connections.

Leave a Reply