No, there isn’t (I just checked 1 hour ago). You can comment the bind-address in my.cnf:
Note: « 1 hour ago » is now more than 10 years ago.
#skip-networking #bind-address = 127.0.0.1
If you want only 2 IPs, you will then have to use a firewall.
For MySql version 8.0.13 and above, you can specify a list of comma-separated IP addresses.
bind-address = 10.0.0.1,10.0.1.1,10.0.2.1
Relevant MySql documentation.
Remember to restart your MySQL instance after changing the config file.
Binding to 127.0.0.x won’t make it available to all the devices, it will make it available locally only. If you wish to make it available to all the interfaces, you should use 0.0.0.0. If you wish to access it from more than one, but less than all the interfaces, you should bind to 0.0.0.0 and firewall off the interfaces you don’t want to be accessed through.
Also, as a second layer of security, you should make sure that all your MySQL users have host field set to something other than % (ie any host).
You can’t bind to more than one IP address, but you can bind to all available IP addresses instead. If so, just use
0.0.0.0 for a binding address in your MySQL configuration file (e.g. /etc/mysql/my.cnf) as follows:
bind-address = 0.0.0.0
If the address is 0.0.0.0, the server accepts TCP/IP connections on all server host IPv4 interfaces.
Furthermore if the address is
::, the server accepts TCP/IP connections on all server host IPv4 and IPv6 interfaces. Use this address to permit both IPv4 and IPv6 connections on all server interfaces.
Or you can simply comment out
bind-address= altogether, so it will bind to all addresses. But make sure that you don’t have
skip-networking enabled in your my.cnf if you want to allow remote connections as well (Read more: MySQL: Allow both remote AND local connections).
After changing the binding address, don’t forget to restart your MySQL server by:
sudo service mysql restart
Eventually you can consider to run multiple instances of MySQL on a single machine (different ports) with Master/Slave replication. Replication enables data from one MySQL database server (the master) to be copied to one or more MySQL database servers (the slaves).
- 5.3 Running Multiple MySQL Instances on One Machine at MySQL.com
- Chapter 17 Replication at MySQL.com