What is MySQL Bind Address?
MySQL Bind Address is configuration option which tells on which interface to accept/listen connections.When we install MySQL Database it accepts connections only from localhost server.
Change Bind Address for MySQL 5.7 in Ubuntu 16.04
By default, In MySQL 5.7 database server remote access is disabled for security reason.To enable remote connections of MySQL Server, we have to change bind-address in MySQL configuration file.
Open the /etc/mysql/mysql.conf.d/mysqld.cnf file
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
Below the [mysqld] section find the Line,
[mysqld] bind-address = 127.0.0.1
replace it to 0.0.0.0 to listen from all interfaces and save the file.
bind-address = 0.0.0.0
Output:
Restart the MySQL Server to take effect.
$ sudo systemctl restart mysql.service
Change Bind Address for MySQL 8.0 in Ubuntu 18.04
In MySQL 8.0 Database, Open the /etc/mysql/mysql.conf.d/mysqld.cnf file
sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf
Below the [mysqld] section find the Line,
[mysqld] bind-address = 127.0.0.1
replace it to 0.0.0.0 to listen from all interfaces and save the file.
bind-address = 0.0.0.0
Restart the MySQL Server to take effect.
$ sudo systemctl restart mysql.service