-1

How could I get MariaDB 10.1 to listen only on IPv4? Strange but true the very first time I installed MariaDB and started it, I saw that it was correctly listening on IPv4 as shown in the example picture below

enter image description here

But strangely after reinstalling MariaDB for some reasons and rebooting my Centos 7 installation, it seems to have started listening only on IPv6 and I hence I cannot get the Galera Cluster to work (which was working fine when it was listening on IPv4). So how do I get this MariaDB to listen only on IPv4. The below is a screenshot from my machine

[root@dataqry-0001 ~]# netstat -ntpl | grep sql
tcp6 0      0 :::3306                 :::*          LISTEN      14323/mysqld

Contents of /etc/my.cnf.d/server.cnf (Pls note that I also tried uncommenting out the bind address, it is still the same strangely)

#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]

#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0
#
# Optional setting
#wsrep_slave_threads=1
#innodb_flush_log_at_trx_commit=0

# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.1 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.1]

I should add that I am quite confused with MariaDB / MySQL settings littered all over the place. The above bind-address is for Galera I guess. It's my first time with MariaDB on Centos 7, so apologies - I even tried disabling IPv6 earlier but doesn't show it listening on IPv4

Thanks M.M

R.W
  • 530
  • 1
  • 12
  • 34
  • Can you post your `my.ini` . I want to check the value on `bind-address` – Hackerman Aug 30 '16 at 13:26
  • Thanks Hackerman, I added the .cnf file to the OP. There are a bunch of .cnf files in the /usr/share/mysql. Could it be the mysql.server file or something you are referring to? – R.W Aug 30 '16 at 14:57
  • My mistake, it should be `my.cnf`, and it's available on `/etc/my.cnf`...so just try `less /etc/my.cnf`...or maybe you post the right file, you can try uncommenting this line `#bind-address=0.0.0.0`(just remove the `#` and restart the server – Hackerman Aug 30 '16 at 15:06

1 Answers1

2

Preface

Although the information in the official MariaDB bug-tracker seems to suggest that this is not possible, unless the mysql software is used instead; I can confirm that setting the following configuration option in e.g. /etc/my.cnf, at least while using version 10.1.21-MariaDB, does work as expected and as outlined in @Hackerman's comment.

bind-address=0.0.0.0

The misunderstood/misleading/irrelevant official bug-trackers I eluded to:


Answer

To answer the question as it pertains to your specific scenario, however, you should pay attention to the "section" under which that setting is set; namely, you have it written under the [galera] section, rather than the server-wide [mysqld] section.

[mysqld]

#
# * Galera-related settings
#
[galera]
# Mandatory settings
#wsrep_on=ON
#wsrep_provider=
#wsrep_cluster_address=
#binlog_format=row
#default_storage_engine=InnoDB
#innodb_autoinc_lock_mode=2
#
# Allow server to accept connections on all interfaces.
#
#bind-address=0.0.0.0

Make sure bind-address is specified in the [mysqld] section.

ILMostro_7
  • 1,422
  • 20
  • 28