Background:
I had to move the MySQL DB on a monitoring system to a different folder due to a lack of space (bc the vspheredb module fills up the DB https://github.com/Icinga/icingaweb2-module-vspheredb/issues/73)
So now the Db is in a different folder than /var/lib/mysql.
(Dumb) Question: I move the datadir and socket to the new location.
Why do I need to use the IP address in the resource configureation now and can’t use “localhost” anymore? Is it hardcoded that “localhost” refers to a specific path for the socket?
Or did I just miss some setting?
I’ve seen systems where localhost is not resolves to an IP address, but instead uses some internal magic to point to a unix socket instead. This is likely done for two reasons: 1) unix sockets have less packet overhead than tcp packages for the kernel 2) dns shouldn’t be involved.
In case you are working on a host, I’d always use IP addresses instead of localhost anyways.
Thanks for the quick answer.
Localhost resolves to 127.0.0.1.
But the “problem” is too insignificant as to dump more time into it to figure it out
Then I will not make a big fuss about it and just use the IP.
If i remember correctly, if you use “localhost” for the connections, mysql clients will connect to the socket. Using the ip, the client makes a tcp connection.
On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs: the client connects using a Unix socket file. The --socket option or the MYSQL_UNIX_PORT environment variable may be used to specify the socket name.