Mariadb Bind-Address Not Updating?

I'm trying to set the bind-address of my MariaDB installation to 0.0.0.0 to allow external connections.

I edited /etc/mysql/mysql.conf.d/mysqld.cnf and updated the [mysqld] section to the following:

[mysqld]
...
bind-address = 0.0.0.0
...

After running sudo service mariadb restart, I still wasn't able to connect from external sources. I'm able to confirm that the bind-address wasn't updated by running mysqld --print-defaults. The output is below, you might have to horizonally scroll a little to see the bolded argument.

mysqld would have been started with the following arguments:
--user=mysql --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306 --basedir=/usr --datadir=/var/lib/mysql --tmpdir=/tmp --lc-messages-dir=/usr/share/mysql --skip-external-locking --bind-address=127.0.0.1 --key_buffer_size=16M --max_allowed_packet=16M --thread_stack=192K --thread_cache_size=8 --myisam_recover_options=BACKUP --query_cache_limit=1M --query_cache_size=16M --log_error=/var/log/mysql/error.log --expire_logs_days=10 --max_binlog_size=100M --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci

How can I properly update the bind-address?

2 Answers

So, it turns out I was editing the wrong configuration file. After running strace mysqld --print-defaults I found it opening a different file.

Updating the bind-address in /etc/mysql/mariadb.conf.d/50-server.cnf changed the option correctly.

Also noteworthy: mariadb.cnf sources both conf.d and mariadb.conf.d directories. I was wondering why I just couldn't get rid of the bind-address=127.0.0.1 option.

It was because I made the backup original.50-server.cnf, which still was read.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest