This seems very strange:
I have a MariaDB Galera cluster with three nodes, and each node has virtually the same configuration.
Since it's a Galera cluster, the database users are the same across all three nodes.
On node 1 and node 2 I get the expected hostname for the user:
mariadb --no-defaults -utheusername -p'thepassword' -h127.0.0.1 -e"select user()"
+-----------------------+
| user() |
+-----------------------+
| theusername@127.0.0.1 |
+-----------------------+
However, on the third node it always ignores the request to use host 127.0.0.1 and replaces this with localhost:
mariadb --no-defaults -utheusername -p'thepassword' -h127.0.0.1 -e"select user()"
+-----------------------+
| user() |
+-----------------------+
| theusername@localhost |
+-----------------------+
If I instead log in interactively (remove the -e option) and run the status command, it shows that the connection is over TCP/IP (not socket although the user's host is still localhost) on all the nodes:
Connection: 127.0.0.1 via TCP/IP
What could be the reason for this?