From fa347003219d94a00890c4c8eee612665fb8478b Mon Sep 17 00:00:00 2001 From: mueller-ma <22525368+mueller-ma@users.noreply.github.com> Date: Tue, 14 Jul 2026 10:26:46 +0200 Subject: [PATCH] mysql: find sockets on default mariadb installation on Debian The current auto-detect command doesn't work on a default MariaDB installation on Debian for two reasons: - The account is called mariadbd - No "socket" is in the CMD printed by ps As the default socket is `/run/mysqld/mysqld.sock`, use all sockets in `/run/mysqld` to support multi-instance setups. From new Debian installation: ``` root@ca9b0a452ef5:/# grep socket -Ri /etc/mysql/ /etc/mysql/my.cnf:# Port or socket location where to connect /etc/mysql/my.cnf:socket = /run/mysqld/mysqld.sock /etc/mysql/my.cnf.fallback:# Remember to edit /etc/mysql/debian.cnf when changing the socket location. /etc/mysql/debian.cnf:# anyway thanks to unix socket authentication and hence /etc/mysql/mariadb.cnf:# Port or socket location where to connect /etc/mysql/mariadb.cnf:socket = /run/mysqld/mysqld.sock ``` --- agents/plugins/mk_mysql | 3 +++ 1 file changed, 3 insertions(+) diff --git a/agents/plugins/mk_mysql b/agents/plugins/mk_mysql index 2b1325dd5cb..cde33f7e263 100755 --- a/agents/plugins/mk_mysql +++ b/agents/plugins/mk_mysql @@ -78,6 +78,9 @@ alias_string=$(grep -F -h alias "$MK_CONFDIR"/mysql{.local,}.cfg | sed -ne 's/.* if [ -z "$mysql_socket_string" ]; then mysql_socket_string=$(ps -fww -C mysqld | grep "socket" | sed -ne 's/.*socket=\([^ ]*\).*/\1/p') fi +if [ -z "$mysql_socket_string" ]; then + mysql_socket_string=$(find /run/mysqld -type s) +fi if [ -z "$mysql_socket_string" ]; then do_query "" "" else